Misc fixes

Should bring bag djgpp bot.
This commit is contained in:
Behdad Esfahbod 2018-02-16 16:58:17 -08:00
parent df9e22656d
commit e5ab34fd3a
2 changed files with 34 additions and 36 deletions

View File

@ -78,7 +78,7 @@ struct os2
{ {
hb_codepoint_t min = -1, max = 0; 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]; hb_codepoint_t cp = codepoints[i];
if (cp < min) if (cp < min)
@ -100,47 +100,47 @@ struct os2
HBUINT16 version; HBUINT16 version;
/* Version 0 */ /* Version 0 */
HBINT16 xAvgCharWidth; HBINT16 xAvgCharWidth;
HBUINT16 usWeightClass; HBUINT16 usWeightClass;
HBUINT16 usWidthClass; HBUINT16 usWidthClass;
HBUINT16 fsType; HBUINT16 fsType;
HBINT16 ySubscriptXSize; HBINT16 ySubscriptXSize;
HBINT16 ySubscriptYSize; HBINT16 ySubscriptYSize;
HBINT16 ySubscriptXOffset; HBINT16 ySubscriptXOffset;
HBINT16 ySubscriptYOffset; HBINT16 ySubscriptYOffset;
HBINT16 ySuperscriptXSize; HBINT16 ySuperscriptXSize;
HBINT16 ySuperscriptYSize; HBINT16 ySuperscriptYSize;
HBINT16 ySuperscriptXOffset; HBINT16 ySuperscriptXOffset;
HBINT16 ySuperscriptYOffset; HBINT16 ySuperscriptYOffset;
HBINT16 yStrikeoutSize; HBINT16 yStrikeoutSize;
HBINT16 yStrikeoutPosition; HBINT16 yStrikeoutPosition;
HBINT16 sFamilyClass; HBINT16 sFamilyClass;
HBUINT8 panose[10]; HBUINT8 panose[10];
HBUINT32 ulUnicodeRange[4]; HBUINT32 ulUnicodeRange[4];
Tag achVendID; Tag achVendID;
HBUINT16 fsSelection; HBUINT16 fsSelection;
HBUINT16 usFirstCharIndex; HBUINT16 usFirstCharIndex;
HBUINT16 usLastCharIndex; HBUINT16 usLastCharIndex;
HBINT16 sTypoAscender; HBINT16 sTypoAscender;
HBINT16 sTypoDescender; HBINT16 sTypoDescender;
HBINT16 sTypoLineGap; HBINT16 sTypoLineGap;
HBUINT16 usWinAscent; HBUINT16 usWinAscent;
HBUINT16 usWinDescent; HBUINT16 usWinDescent;
/* Version 1 */ /* Version 1 */
//HBUINT32 ulCodePageRange1; //HBUINT32 ulCodePageRange1;
//HBUINT32 ulCodePageRange2; //HBUINT32 ulCodePageRange2;
/* Version 2 */ /* Version 2 */
//HBINT16 sxHeight; //HBINT16 sxHeight;
//HBINT16 sCapHeight; //HBINT16 sCapHeight;
//HBUINT16 usDefaultChar; //HBUINT16 usDefaultChar;
//HBUINT16 usBreakChar; //HBUINT16 usBreakChar;
//HBUINT16 usMaxContext; //HBUINT16 usMaxContext;
/* Version 5 */ /* Version 5 */
//HBUINT16 usLowerOpticalPointSize; //HBUINT16 usLowerOpticalPointSize;
//HBUINT16 usUpperOpticalPointSize; //HBUINT16 usUpperOpticalPointSize;
public: public:
DEFINE_SIZE_STATIC (78); DEFINE_SIZE_STATIC (78);

View File

@ -130,9 +130,11 @@ _populate_gids_to_retain (hb_face_t *face,
hb_auto_array_t<unsigned int> bad_indices; hb_auto_array_t<unsigned int> bad_indices;
old_gids.alloc (codepoints.len); 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; hb_codepoint_t gid;
if (!cmap.get_nominal_glyph (codepoints[i], &gid)) { if (!cmap.get_nominal_glyph (codepoints[i], &gid))
{
gid = -1; gid = -1;
*(bad_indices.push ()) = i; *(bad_indices.push ()) = i;
} }
@ -140,7 +142,8 @@ _populate_gids_to_retain (hb_face_t *face,
} }
/* Generally there shouldn't be any */ /* 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]; unsigned int i = bad_indices[bad_indices.len - 1];
bad_indices.pop (); bad_indices.pop ();
DEBUG_MSG(SUBSET, nullptr, "Drop U+%04X; no gid", codepoints[i]); 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 (); hb_set_t * all_gids_to_retain = hb_set_create ();
_add_gid_and_children (glyf, 0, all_gids_to_retain); _add_gid_and_children (glyf, 0, all_gids_to_retain);
for (unsigned int i = 0; i < old_gids.len; i++) for (unsigned int i = 0; i < old_gids.len; i++)
{
_add_gid_and_children (glyf, old_gids[i], all_gids_to_retain); _add_gid_and_children (glyf, old_gids[i], all_gids_to_retain);
}
// Transfer to a sorted list. // Transfer to a sorted list.
old_gids_sorted.alloc (hb_set_get_population (all_gids_to_retain)); 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)) while (hb_set_next (all_gids_to_retain, &gid))
{
*(old_gids_sorted.push ()) = gid; *(old_gids_sorted.push ()) = gid;
}
old_gids_sorted.qsort (_hb_codepoint_t_cmp);
glyf.fini (); glyf.fini ();
cmap.fini (); cmap.fini ();