Merge pull request #1844 from ebraminio/hhea
Fallback hhea's ascender/descender to OS2
This commit is contained in:
commit
ac8b6e330a
|
@ -60,14 +60,14 @@ hb_ot_metrics_get_position_internal (hb_face_t *face,
|
||||||
(face->table.TABLE->has_data () && \
|
(face->table.TABLE->has_data () && \
|
||||||
(position && (*position = face->table.TABLE->ATTR + GET_VAR), true))
|
(position && (*position = face->table.TABLE->ATTR + GET_VAR), true))
|
||||||
case HB_OT_METRICS_HORIZONTAL_ASCENDER:
|
case HB_OT_METRICS_HORIZONTAL_ASCENDER:
|
||||||
return (face->table.OS2->use_typo_metrics () && GET_METRIC (OS2, sTypoAscender)) ||
|
return (!face->table.OS2->use_typo_metrics () && GET_METRIC (hhea, ascender)) ||
|
||||||
GET_METRIC (hhea, ascender);
|
GET_METRIC (OS2, sTypoAscender);
|
||||||
case HB_OT_METRICS_HORIZONTAL_DESCENDER:
|
case HB_OT_METRICS_HORIZONTAL_DESCENDER:
|
||||||
return (face->table.OS2->use_typo_metrics () && GET_METRIC (OS2, sTypoDescender)) ||
|
return (!face->table.OS2->use_typo_metrics () && GET_METRIC (hhea, descender)) ||
|
||||||
GET_METRIC (hhea, descender);
|
GET_METRIC (OS2, sTypoDescender);
|
||||||
case HB_OT_METRICS_HORIZONTAL_LINE_GAP:
|
case HB_OT_METRICS_HORIZONTAL_LINE_GAP:
|
||||||
return (face->table.OS2->use_typo_metrics () && GET_METRIC (OS2, sTypoLineGap)) ||
|
return (!face->table.OS2->use_typo_metrics () && GET_METRIC (hhea, lineGap)) ||
|
||||||
GET_METRIC (hhea, lineGap);
|
GET_METRIC (OS2, sTypoLineGap);
|
||||||
case HB_OT_METRICS_HORIZONTAL_CLIPPING_ASCENT: return GET_METRIC (OS2, usWinAscent);
|
case HB_OT_METRICS_HORIZONTAL_CLIPPING_ASCENT: return GET_METRIC (OS2, usWinAscent);
|
||||||
case HB_OT_METRICS_HORIZONTAL_CLIPPING_DESCENT: return GET_METRIC (OS2, usWinDescent);
|
case HB_OT_METRICS_HORIZONTAL_CLIPPING_DESCENT: return GET_METRIC (OS2, usWinDescent);
|
||||||
case HB_OT_METRICS_VERTICAL_ASCENDER: return GET_METRIC (vhea, ascender);
|
case HB_OT_METRICS_VERTICAL_ASCENDER: return GET_METRIC (vhea, ascender);
|
||||||
|
|
|
@ -117,8 +117,8 @@ struct OS2
|
||||||
OBLIQUE = 1u<<9
|
OBLIQUE = 1u<<9
|
||||||
};
|
};
|
||||||
|
|
||||||
bool is_italic () const { return fsSelection & ITALIC; }
|
bool is_italic () const { return fsSelection & ITALIC; }
|
||||||
bool is_oblique () const { return fsSelection & OBLIQUE; }
|
bool is_oblique () const { return fsSelection & OBLIQUE; }
|
||||||
bool use_typo_metrics () const { return fsSelection & USE_TYPO_METRICS; }
|
bool use_typo_metrics () const { return fsSelection & USE_TYPO_METRICS; }
|
||||||
|
|
||||||
enum width_class_t {
|
enum width_class_t {
|
||||||
|
@ -196,13 +196,14 @@ struct OS2
|
||||||
}
|
}
|
||||||
|
|
||||||
static void find_min_and_max_codepoint (const hb_set_t *codepoints,
|
static void find_min_and_max_codepoint (const hb_set_t *codepoints,
|
||||||
uint16_t *min_cp, /* OUT */
|
uint16_t *min_cp, /* OUT */
|
||||||
uint16_t *max_cp /* OUT */)
|
uint16_t *max_cp /* OUT */)
|
||||||
{
|
{
|
||||||
*min_cp = codepoints->get_min ();
|
*min_cp = codepoints->get_min ();
|
||||||
*max_cp = codepoints->get_max ();
|
*max_cp = codepoints->get_max ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681 */
|
||||||
enum font_page_t {
|
enum font_page_t {
|
||||||
HEBREW_FONT_PAGE = 0xB100, // Hebrew Windows 3.1 font page
|
HEBREW_FONT_PAGE = 0xB100, // Hebrew Windows 3.1 font page
|
||||||
SIMP_ARABIC_FONT_PAGE = 0xB200, // Simplified Arabic Windows 3.1 font page
|
SIMP_ARABIC_FONT_PAGE = 0xB200, // Simplified Arabic Windows 3.1 font page
|
||||||
|
@ -212,8 +213,6 @@ struct OS2
|
||||||
TRAD_FARSI_FONT_PAGE = 0xBB00, // Traditional Farsi Windows 3.1 font page
|
TRAD_FARSI_FONT_PAGE = 0xBB00, // Traditional Farsi Windows 3.1 font page
|
||||||
THAI_FONT_PAGE = 0xDE00 // Thai Windows 3.1 font page
|
THAI_FONT_PAGE = 0xDE00 // Thai Windows 3.1 font page
|
||||||
};
|
};
|
||||||
|
|
||||||
// https://github.com/Microsoft/Font-Validator/blob/520aaae/OTFontFileVal/val_OS2.cs#L644-L681
|
|
||||||
font_page_t get_font_page () const
|
font_page_t get_font_page () const
|
||||||
{ return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); }
|
{ return (font_page_t) (version == 0 ? fsSelection & 0xFF00 : 0); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue