summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz')
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp26
-rw-r--r--src/3rdparty/harfbuzz/src/harfbuzz-shaper.h8
2 files changed, 32 insertions, 2 deletions
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
index af0ee52e9a..f6900325bc 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp
@@ -995,7 +995,7 @@ static HB_Stream getTableStream(void *font, HB_GetFontTableFunc tableFunc, HB_Ta
return stream;
}
-HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
+HB_Face HB_AllocFace(void *font, HB_GetFontTableFunc tableFunc)
{
HB_Face face = (HB_Face )malloc(sizeof(HB_FaceRec));
if (!face)
@@ -1012,6 +1012,30 @@ HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
face->tmpLogClusters = 0;
face->glyphs_substituted = false;
face->buffer = 0;
+ face->font_for_init = font;
+ face->get_font_table_func = tableFunc;
+
+ return face;
+}
+
+HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc)
+{
+ HB_Face face = HB_AllocFace(font, tableFunc);
+ if (face)
+ face = HB_LoadFace(face);
+ return face;
+}
+
+HB_Face HB_LoadFace(HB_Face face)
+{
+ void *font = face->font_for_init;
+ if (!font)
+ return face;
+
+ HB_GetFontTableFunc tableFunc = face->get_font_table_func;
+
+ face->get_font_table_func = 0;
+ face->font_for_init = 0;
HB_Error error = HB_Err_Ok;
HB_Stream stream;
diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
index 470e27b6f9..f225a86525 100644
--- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
+++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h
@@ -201,6 +201,8 @@ typedef struct {
hb_bitfield combiningClass :8;
} HB_GlyphAttributes;
+typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
+
typedef struct HB_FaceRec_ {
HB_Bool isSymbolFont;
@@ -217,11 +219,15 @@ typedef struct HB_FaceRec_ {
unsigned int *tmpLogClusters;
int length;
int orig_nglyphs;
+ void *font_for_init;
+ HB_GetFontTableFunc get_font_table_func;
} HB_FaceRec;
-typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
+
HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc);
+HB_Face HB_AllocFace(void *font, HB_GetFontTableFunc tableFunc);
+HB_Face HB_LoadFace(HB_Face face);
void HB_FreeFace(HB_Face face);
typedef struct {