os2->yStrikeoutSize = ttf->head->units_per_em / 10;
os2->yStrikeoutPosition = ymid;
os2->usWinAscent = ttf->ascent;
- os2->usWinDescent = -ttf->descent;
+ os2->usWinDescent = ttf->descent>0?0:-ttf->descent;
os2->sxHeight = ymid;
os2->sCapHeight = height*2/3;
}
for(t=0;t<ttf->num_glyphs;t++) {
if(ttf->glyphs[t].advance > hea->advanceWidthMax)
hea->advanceWidthMax = ttf->glyphs[t].advance;
- if(ttf->glyphs[t].xmin < hea->minLeftSideBearing)
- hea->minLeftSideBearing = ttf->glyphs[t].xmin;
+ if(ttf->glyphs[t].bearing < hea->minLeftSideBearing)
+ hea->minLeftSideBearing = ttf->glyphs[t].bearing;
if(ttf->glyphs[t].xmax < hea->minRightSideBearing)
hea->minRightSideBearing = ttf->glyphs[t].xmax;
int width = ttf->glyphs[t].xmax - ttf->glyphs[t].xmin;
int t;
for(t=0;t<num_advances;t++) {
writeU16(w, ttf->glyphs[t].advance);
- writeU16(w, ttf->glyphs[t].bearing);
+ writeS16(w, ttf->glyphs[t].bearing);
}
for(;t<ttf->num_glyphs;t++) {
- writeU16(w, ttf->glyphs[t].bearing);
+ writeS16(w, ttf->glyphs[t].bearing);
}
return num_advances;
}
w->data[num_segments_pos++]=(search_range*2);
/* backpatch entry selector */
int entry_selector = 0;
+ tmp = search_range;
while(tmp>1) {tmp>>=1;entry_selector++;}
w->data[num_segments_pos++]=entry_selector>>8;
w->data[num_segments_pos++]=entry_selector;
/* backpatch range shift */
- int range_shift = num_segments*2 - search_range;
+ int range_shift = num_segments*2 - search_range*2;
w->data[num_segments_pos++]=range_shift>>8;
w->data[num_segments_pos++]=range_shift;