Fix OT shaper not working on macOS

Also dont keep an extra reference to the hb font in fonts.c
This commit is contained in:
Kovid Goyal
2017-12-11 09:48:20 +05:30
parent 5407fa72b4
commit 98d8ab2953
2 changed files with 11 additions and 11 deletions

View File

@@ -11,6 +11,7 @@
#include <stdint.h>
#include <math.h>
#include <hb-coretext.h>
#include <hb-ot.h>
#import <CoreGraphics/CGBitmapContext.h>
#import <CoreText/CTFont.h>
#include <Foundation/Foundation.h>
@@ -217,7 +218,11 @@ set_size_for_face(PyObject *s, unsigned int UNUSED desired_height, bool force) {
hb_font_t*
harfbuzz_font_for_face(PyObject* s) {
CTFace *self = (CTFace*)s;
if (!self->hb_font) self->hb_font = hb_coretext_font_create (self->ct_font);
if (!self->hb_font) {
self->hb_font = hb_coretext_font_create(self->ct_font);
if (!self->hb_font) fatal("Failed to create hb_font");
hb_ot_font_set_funcs(self->hb_font);
}
return self->hb_font;
}