From e5ab34fd3a104f7ff2f0b36c66770c88b2ea1051 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 16 Feb 2018 16:58:17 -0800 Subject: [PATCH] Misc fixes Should bring bag djgpp bot. --- src/hb-ot-os2-table.hh | 54 +++++++++++++++++++++--------------------- src/hb-subset-plan.cc | 16 ++++++------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh index 18dc4ab07..2d9d21495 100644 --- a/src/hb-ot-os2-table.hh +++ b/src/hb-ot-os2-table.hh @@ -78,7 +78,7 @@ struct os2 { hb_codepoint_t min = -1, max = 0; - for (int i = 0; i < codepoints.len; i++) + for (unsigned int i = 0; i < codepoints.len; i++) { hb_codepoint_t cp = codepoints[i]; if (cp < min) @@ -100,47 +100,47 @@ struct os2 HBUINT16 version; /* Version 0 */ - HBINT16 xAvgCharWidth; + HBINT16 xAvgCharWidth; HBUINT16 usWeightClass; HBUINT16 usWidthClass; HBUINT16 fsType; - HBINT16 ySubscriptXSize; - HBINT16 ySubscriptYSize; - HBINT16 ySubscriptXOffset; - HBINT16 ySubscriptYOffset; - HBINT16 ySuperscriptXSize; - HBINT16 ySuperscriptYSize; - HBINT16 ySuperscriptXOffset; - HBINT16 ySuperscriptYOffset; - HBINT16 yStrikeoutSize; - HBINT16 yStrikeoutPosition; - HBINT16 sFamilyClass; - HBUINT8 panose[10]; - HBUINT32 ulUnicodeRange[4]; + HBINT16 ySubscriptXSize; + HBINT16 ySubscriptYSize; + HBINT16 ySubscriptXOffset; + HBINT16 ySubscriptYOffset; + HBINT16 ySuperscriptXSize; + HBINT16 ySuperscriptYSize; + HBINT16 ySuperscriptXOffset; + HBINT16 ySuperscriptYOffset; + HBINT16 yStrikeoutSize; + HBINT16 yStrikeoutPosition; + HBINT16 sFamilyClass; + HBUINT8 panose[10]; + HBUINT32 ulUnicodeRange[4]; Tag achVendID; HBUINT16 fsSelection; HBUINT16 usFirstCharIndex; HBUINT16 usLastCharIndex; - HBINT16 sTypoAscender; - HBINT16 sTypoDescender; - HBINT16 sTypoLineGap; + HBINT16 sTypoAscender; + HBINT16 sTypoDescender; + HBINT16 sTypoLineGap; HBUINT16 usWinAscent; HBUINT16 usWinDescent; /* Version 1 */ - //HBUINT32 ulCodePageRange1; - //HBUINT32 ulCodePageRange2; + //HBUINT32 ulCodePageRange1; + //HBUINT32 ulCodePageRange2; /* Version 2 */ - //HBINT16 sxHeight; - //HBINT16 sCapHeight; - //HBUINT16 usDefaultChar; - //HBUINT16 usBreakChar; - //HBUINT16 usMaxContext; + //HBINT16 sxHeight; + //HBINT16 sCapHeight; + //HBUINT16 usDefaultChar; + //HBUINT16 usBreakChar; + //HBUINT16 usMaxContext; /* Version 5 */ - //HBUINT16 usLowerOpticalPointSize; - //HBUINT16 usUpperOpticalPointSize; + //HBUINT16 usLowerOpticalPointSize; + //HBUINT16 usUpperOpticalPointSize; public: DEFINE_SIZE_STATIC (78); diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index d017cca17..b9e299add 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -130,9 +130,11 @@ _populate_gids_to_retain (hb_face_t *face, hb_auto_array_t bad_indices; old_gids.alloc (codepoints.len); - for (unsigned int i = 0; i < codepoints.len; i++) { + for (unsigned int i = 0; i < codepoints.len; i++) + { hb_codepoint_t gid; - if (!cmap.get_nominal_glyph (codepoints[i], &gid)) { + if (!cmap.get_nominal_glyph (codepoints[i], &gid)) + { gid = -1; *(bad_indices.push ()) = i; } @@ -140,7 +142,8 @@ _populate_gids_to_retain (hb_face_t *face, } /* Generally there shouldn't be any */ - while (bad_indices.len > 0) { + while (bad_indices.len > 0) + { unsigned int i = bad_indices[bad_indices.len - 1]; bad_indices.pop (); DEBUG_MSG(SUBSET, nullptr, "Drop U+%04X; no gid", codepoints[i]); @@ -154,18 +157,13 @@ _populate_gids_to_retain (hb_face_t *face, hb_set_t * all_gids_to_retain = hb_set_create (); _add_gid_and_children (glyf, 0, all_gids_to_retain); for (unsigned int i = 0; i < old_gids.len; i++) - { _add_gid_and_children (glyf, old_gids[i], all_gids_to_retain); - } // Transfer to a sorted list. old_gids_sorted.alloc (hb_set_get_population (all_gids_to_retain)); - unsigned int gid = HB_SET_VALUE_INVALID; + hb_codepoint_t gid = HB_SET_VALUE_INVALID; while (hb_set_next (all_gids_to_retain, &gid)) - { *(old_gids_sorted.push ()) = gid; - } - old_gids_sorted.qsort (_hb_codepoint_t_cmp); glyf.fini (); cmap.fini ();