Make HB_TINY builds work again by separating the always needed part
This commit is contained in:
parent
cb70433740
commit
772e62688c
|
@ -234,9 +234,9 @@ hb_ot_get_font_h_extents (hb_font_t *font,
|
||||||
hb_font_extents_t *metrics,
|
hb_font_extents_t *metrics,
|
||||||
void *user_data HB_UNUSED)
|
void *user_data HB_UNUSED)
|
||||||
{
|
{
|
||||||
return hb_ot_metrics_get_position (font, HB_OT_METRICS_HORIZONTAL_ASCENDER, &metrics->ascender) &&
|
return hb_ot_metrics_get_position_common (font, HB_OT_METRICS_HORIZONTAL_ASCENDER, &metrics->ascender) &&
|
||||||
hb_ot_metrics_get_position (font, HB_OT_METRICS_HORIZONTAL_DESCENDER, &metrics->descender) &&
|
hb_ot_metrics_get_position_common (font, HB_OT_METRICS_HORIZONTAL_DESCENDER, &metrics->descender) &&
|
||||||
hb_ot_metrics_get_position (font, HB_OT_METRICS_HORIZONTAL_LINE_GAP, &metrics->line_gap);
|
hb_ot_metrics_get_position_common (font, HB_OT_METRICS_HORIZONTAL_LINE_GAP, &metrics->line_gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static hb_bool_t
|
static hb_bool_t
|
||||||
|
@ -245,9 +245,9 @@ hb_ot_get_font_v_extents (hb_font_t *font,
|
||||||
hb_font_extents_t *metrics,
|
hb_font_extents_t *metrics,
|
||||||
void *user_data HB_UNUSED)
|
void *user_data HB_UNUSED)
|
||||||
{
|
{
|
||||||
return hb_ot_metrics_get_position (font, HB_OT_METRICS_VERTICAL_ASCENDER, &metrics->ascender) &&
|
return hb_ot_metrics_get_position_common (font, HB_OT_METRICS_VERTICAL_ASCENDER, &metrics->ascender) &&
|
||||||
hb_ot_metrics_get_position (font, HB_OT_METRICS_VERTICAL_DESCENDER, &metrics->descender) &&
|
hb_ot_metrics_get_position_common (font, HB_OT_METRICS_VERTICAL_DESCENDER, &metrics->descender) &&
|
||||||
hb_ot_metrics_get_position (font, HB_OT_METRICS_VERTICAL_LINE_GAP, &metrics->line_gap);
|
hb_ot_metrics_get_position_common (font, HB_OT_METRICS_VERTICAL_LINE_GAP, &metrics->line_gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HB_USE_ATEXIT
|
#if HB_USE_ATEXIT
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
#include "hb.hh"
|
#include "hb.hh"
|
||||||
|
|
||||||
#ifndef HB_NO_METRICS
|
|
||||||
|
|
||||||
#include "hb-ot-var-mvar-table.hh"
|
#include "hb-ot-var-mvar-table.hh"
|
||||||
#include "hb-ot-gasp-table.hh" // Just so we compile it; unused otherwise.
|
#include "hb-ot-gasp-table.hh" // Just so we compile it; unused otherwise.
|
||||||
#include "hb-ot-os2-table.hh"
|
#include "hb-ot-os2-table.hh"
|
||||||
|
@ -34,6 +32,48 @@
|
||||||
#include "hb-ot-metrics.hh"
|
#include "hb-ot-metrics.hh"
|
||||||
#include "hb-ot-face.hh"
|
#include "hb-ot-face.hh"
|
||||||
|
|
||||||
|
/* Common part of _get_position logic needed on hb-ot-font so we
|
||||||
|
can have a slim builds using HB_NO_METRICS */
|
||||||
|
bool
|
||||||
|
hb_ot_metrics_get_position_common (hb_font_t *font,
|
||||||
|
hb_ot_metrics_t metrics_tag,
|
||||||
|
hb_position_t *position /* OUT. May be NULL. */)
|
||||||
|
{
|
||||||
|
hb_face_t *face = font->face;
|
||||||
|
switch ((unsigned int) metrics_tag)
|
||||||
|
{
|
||||||
|
#ifndef HB_NO_VAR
|
||||||
|
#define GET_VAR hb_ot_metrics_get_variation (face, metrics_tag)
|
||||||
|
#else
|
||||||
|
#define GET_VAR 0
|
||||||
|
#endif
|
||||||
|
#define GET_METRIC_X(TABLE, ATTR) \
|
||||||
|
(face->table.TABLE->has_data () && \
|
||||||
|
(position && (*position = font->em_scalef_x (face->table.TABLE->ATTR + GET_VAR)), true))
|
||||||
|
#define GET_METRIC_Y(TABLE, ATTR) \
|
||||||
|
(face->table.TABLE->has_data () && \
|
||||||
|
(position && (*position = font->em_scalef_y (face->table.TABLE->ATTR + GET_VAR)), true))
|
||||||
|
case HB_OT_METRICS_HORIZONTAL_ASCENDER:
|
||||||
|
return (!face->table.OS2->use_typo_metrics () && GET_METRIC_Y (hhea, ascender)) ||
|
||||||
|
GET_METRIC_Y (OS2, sTypoAscender);
|
||||||
|
case HB_OT_METRICS_HORIZONTAL_DESCENDER:
|
||||||
|
return (!face->table.OS2->use_typo_metrics () && GET_METRIC_Y (hhea, descender)) ||
|
||||||
|
GET_METRIC_Y (OS2, sTypoDescender);
|
||||||
|
case HB_OT_METRICS_HORIZONTAL_LINE_GAP:
|
||||||
|
return (!face->table.OS2->use_typo_metrics () && GET_METRIC_Y (hhea, lineGap)) ||
|
||||||
|
GET_METRIC_Y (OS2, sTypoLineGap);
|
||||||
|
case HB_OT_METRICS_VERTICAL_ASCENDER: return GET_METRIC_X (vhea, ascender);
|
||||||
|
case HB_OT_METRICS_VERTICAL_DESCENDER: return GET_METRIC_X (vhea, descender);
|
||||||
|
case HB_OT_METRICS_VERTICAL_LINE_GAP: return GET_METRIC_X (vhea, lineGap);
|
||||||
|
#undef GET_METRIC_Y
|
||||||
|
#undef GET_METRIC_X
|
||||||
|
#undef GET_VAR
|
||||||
|
default: assert (0); return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef HB_NO_METRICS
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static bool
|
static bool
|
||||||
_get_gasp (hb_face_t *face, float *result, hb_ot_metrics_t metrics_tag)
|
_get_gasp (hb_face_t *face, float *result, hb_ot_metrics_t metrics_tag)
|
||||||
|
@ -64,6 +104,12 @@ hb_ot_metrics_get_position (hb_font_t *font,
|
||||||
hb_face_t *face = font->face;
|
hb_face_t *face = font->face;
|
||||||
switch (metrics_tag)
|
switch (metrics_tag)
|
||||||
{
|
{
|
||||||
|
case HB_OT_METRICS_HORIZONTAL_ASCENDER:
|
||||||
|
case HB_OT_METRICS_HORIZONTAL_DESCENDER:
|
||||||
|
case HB_OT_METRICS_HORIZONTAL_LINE_GAP:
|
||||||
|
case HB_OT_METRICS_VERTICAL_ASCENDER:
|
||||||
|
case HB_OT_METRICS_VERTICAL_DESCENDER:
|
||||||
|
case HB_OT_METRICS_VERTICAL_LINE_GAP: return hb_ot_metrics_get_position_common (font, metrics_tag, position);
|
||||||
#ifndef HB_NO_VAR
|
#ifndef HB_NO_VAR
|
||||||
#define GET_VAR hb_ot_metrics_get_variation (face, metrics_tag)
|
#define GET_VAR hb_ot_metrics_get_variation (face, metrics_tag)
|
||||||
#else
|
#else
|
||||||
|
@ -75,18 +121,6 @@ hb_ot_metrics_get_position (hb_font_t *font,
|
||||||
#define GET_METRIC_Y(TABLE, ATTR) \
|
#define GET_METRIC_Y(TABLE, ATTR) \
|
||||||
(face->table.TABLE->has_data () && \
|
(face->table.TABLE->has_data () && \
|
||||||
(position && (*position = font->em_scalef_y (face->table.TABLE->ATTR + GET_VAR)), true))
|
(position && (*position = font->em_scalef_y (face->table.TABLE->ATTR + GET_VAR)), true))
|
||||||
case HB_OT_METRICS_HORIZONTAL_ASCENDER:
|
|
||||||
return (!face->table.OS2->use_typo_metrics () && GET_METRIC_Y (hhea, ascender)) ||
|
|
||||||
GET_METRIC_Y (OS2, sTypoAscender);
|
|
||||||
case HB_OT_METRICS_HORIZONTAL_DESCENDER:
|
|
||||||
return (!face->table.OS2->use_typo_metrics () && GET_METRIC_Y (hhea, descender)) ||
|
|
||||||
GET_METRIC_Y (OS2, sTypoDescender);
|
|
||||||
case HB_OT_METRICS_HORIZONTAL_LINE_GAP:
|
|
||||||
return (!face->table.OS2->use_typo_metrics () && GET_METRIC_Y (hhea, lineGap)) ||
|
|
||||||
GET_METRIC_Y (OS2, sTypoLineGap);
|
|
||||||
case HB_OT_METRICS_VERTICAL_ASCENDER: return GET_METRIC_X (vhea, ascender);
|
|
||||||
case HB_OT_METRICS_VERTICAL_DESCENDER: return GET_METRIC_X (vhea, descender);
|
|
||||||
case HB_OT_METRICS_VERTICAL_LINE_GAP: return GET_METRIC_X (vhea, lineGap);
|
|
||||||
case HB_OT_METRICS_HORIZONTAL_CLIPPING_ASCENT: return GET_METRIC_Y (OS2, usWinAscent);
|
case HB_OT_METRICS_HORIZONTAL_CLIPPING_ASCENT: return GET_METRIC_Y (OS2, usWinAscent);
|
||||||
case HB_OT_METRICS_HORIZONTAL_CLIPPING_DESCENT: return GET_METRIC_Y (OS2, usWinDescent);
|
case HB_OT_METRICS_HORIZONTAL_CLIPPING_DESCENT: return GET_METRIC_Y (OS2, usWinDescent);
|
||||||
case HB_OT_METRICS_HORIZONTAL_CARET_RISE: return GET_METRIC_Y (hhea, caretSlopeRise);
|
case HB_OT_METRICS_HORIZONTAL_CARET_RISE: return GET_METRIC_Y (hhea, caretSlopeRise);
|
||||||
|
|
|
@ -27,4 +27,9 @@
|
||||||
|
|
||||||
#include "hb.hh"
|
#include "hb.hh"
|
||||||
|
|
||||||
|
HB_INTERNAL bool
|
||||||
|
hb_ot_metrics_get_position_common (hb_font_t *font,
|
||||||
|
hb_ot_metrics_t metrics_tag,
|
||||||
|
hb_position_t *position /* OUT. May be NULL. */);
|
||||||
|
|
||||||
#endif /* HB_OT_METRICS_HH */
|
#endif /* HB_OT_METRICS_HH */
|
||||||
|
|
Loading…
Reference in New Issue