[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Sep 11 14:42:21 UTC 2018
src/hb-face.cc | 5 +++--
src/hb-open-file.hh | 21 ++++++++++++++-------
2 files changed, 17 insertions(+), 9 deletions(-)
New commits:
commit 9479ffefbfa3ea4ee39747e34177d26ab1ebbec9
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Sep 11 16:41:26 2018 +0200
[dfont] Re-enable and fix offset handling
Fixes https://github.com/harfbuzz/harfbuzz/pull/1085
diff --git a/src/hb-face.cc b/src/hb-face.cc
index 92c34152..922fd8fd 100644
--- a/src/hb-face.cc
+++ b/src/hb-face.cc
@@ -163,11 +163,12 @@ _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void
return hb_blob_reference (data->blob);
const OT::OpenTypeFontFile &ot_file = *data->blob->as<OT::OpenTypeFontFile> ();
- const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index);
+ unsigned int base_offset;
+ const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index, &base_offset);
const OT::OpenTypeTable &table = ot_face.get_table_by_tag (tag);
- hb_blob_t *blob = hb_blob_create_sub_blob (data->blob, table.offset, table.length);
+ hb_blob_t *blob = hb_blob_create_sub_blob (data->blob, base_offset + table.offset, table.length);
return blob;
}
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index b1732057..608de0a9 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -428,14 +428,19 @@ struct ResourceForkHeader
return StructAtOffset<LArrayOf<HBUINT8> > (this, offset);
}
- inline const OpenTypeFontFace& get_face (unsigned int idx) const
+ inline const OpenTypeFontFace& get_face (unsigned int idx, unsigned int *base_offset = nullptr) const
{
const ResourceMap &resource_map = this+map;
for (unsigned int i = 0; i < resource_map.get_types_count (); ++i)
{
const ResourceTypeItem& type = resource_map.get_type (i);
if (type.is_sfnt () && idx < type.get_resource_count ())
- return (OpenTypeFontFace&) get_data (type, idx).arrayZ;
+ {
+ const OpenTypeFontFace &face = (OpenTypeFontFace&) get_data (type, idx).arrayZ;
+ if (base_offset)
+ *base_offset = (const char *) &face - (const char *) this;
+ return face;
+ }
}
return Null (OpenTypeFontFace);
}
@@ -502,12 +507,14 @@ struct OpenTypeFontFile
case Typ1Tag:
case TrueTypeTag: return 1;
case TTCTag: return u.ttcHeader.get_face_count ();
-// case DFontTag: return u.rfHeader.get_face_count ();
+ case DFontTag: return u.rfHeader.get_face_count ();
default: return 0;
}
}
- inline const OpenTypeFontFace& get_face (unsigned int i) const
+ inline const OpenTypeFontFace& get_face (unsigned int i, unsigned int *base_offset = nullptr) const
{
+ if (base_offset)
+ *base_offset = 0;
switch (u.tag) {
/* Note: for non-collection SFNT data we ignore index. This is because
* Apple dfont container is a container of SFNT's. So each SFNT is a
@@ -517,7 +524,7 @@ struct OpenTypeFontFile
case Typ1Tag:
case TrueTypeTag: return u.fontFace;
case TTCTag: return u.ttcHeader.get_face (i);
-// case DFontTag: return u.rfHeader.get_face (i);
+ case DFontTag: return u.rfHeader.get_face (i, base_offset);
default: return Null(OpenTypeFontFace);
}
}
@@ -544,7 +551,7 @@ struct OpenTypeFontFile
case Typ1Tag:
case TrueTypeTag: return_trace (u.fontFace.sanitize (c));
case TTCTag: return_trace (u.ttcHeader.sanitize (c));
-// case DFontTag: return_trace (u.rfHeader.sanitize (c));
+ case DFontTag: return_trace (u.rfHeader.sanitize (c));
default: return_trace (true);
}
}
commit a1814e2bec3a43b9eeb4d50a67daae3fc52fd0a5
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Sep 11 14:45:23 2018 +0200
Whitespace
diff --git a/src/hb-open-file.hh b/src/hb-open-file.hh
index d3b74860..b1732057 100644
--- a/src/hb-open-file.hh
+++ b/src/hb-open-file.hh
@@ -485,7 +485,7 @@ struct OpenTypeFontFile
{
enum {
CFFTag = HB_TAG ('O','T','T','O'), /* OpenType with Postscript outlines */
- TrueTypeTag = HB_TAG ( 0 , 1 , 0 , 0 ), /* OpenType with TrueType outlines */
+ TrueTypeTag = HB_TAG ( 0 , 1 , 0 , 0 ), /* OpenType with TrueType outlines */
TTCTag = HB_TAG ('t','t','c','f'), /* TrueType Collection */
DFontTag = HB_TAG ( 0 , 0 , 1 , 0 ), /* DFont Mac Resource Fork */
TrueTag = HB_TAG ('t','r','u','e'), /* Obsolete Apple TrueType */
More information about the HarfBuzz
mailing list