[hmtx] Use more conventional internal API style

This commit is contained in:
Ebrahim Byagowi 2019-10-03 15:59:45 +03:30
parent c9577a630f
commit ee7610181c
5 changed files with 22 additions and 52 deletions

View File

@ -75,7 +75,6 @@ HB_BASE_sources = \
hb-ot-hdmx-table.hh \
hb-ot-head-table.hh \
hb-ot-hhea-table.hh \
hb-ot-hmtx-table.cc \
hb-ot-hmtx-table.hh \
hb-ot-kern-table.hh \
hb-ot-layout-base-table.hh \

View File

@ -14,7 +14,6 @@
#include "hb-ot-color.cc"
#include "hb-ot-face.cc"
#include "hb-ot-font.cc"
#include "hb-ot-hmtx-table.cc"
#include "hb-ot-layout.cc"
#include "hb-ot-map.cc"
#include "hb-ot-math.cc"

View File

@ -315,5 +315,17 @@ hb_ot_font_set_funcs (hb_font_t *font)
nullptr);
}
int
hb_ot_get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
{
return font->face->table.glyf->get_side_bearing_var (glyph, font->coords, font->num_coords, is_vertical);
}
unsigned
hb_ot_get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
{
return font->face->table.glyf->get_advance_var (glyph, font->coords, font->num_coords, is_vertical);
}
#endif

View File

@ -1,42 +0,0 @@
/*
* Copyright © 2019 Adobe Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
* Permission is hereby granted, without written agreement and without
* license or royalty fees, to use, copy, modify, and distribute this
* software and its documentation for any purpose, provided that the
* above copyright notice and the following two paragraphs appear in
* all copies of this software.
*
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* Adobe Author(s): Michiharu Ariza
*/
#include "hb-ot-hmtx-table.hh"
#include "hb-ot-glyf-table.hh"
namespace OT {
int hmtxvmtx_accelerator_base_t::get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
{
return font->face->table.glyf->get_side_bearing_var (glyph, font->coords, font->num_coords, is_vertical);
}
unsigned int hmtxvmtx_accelerator_base_t::get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical)
{
return font->face->table.glyf->get_advance_var (glyph, font->coords, font->num_coords, is_vertical);
}
}

View File

@ -42,6 +42,13 @@
#define HB_OT_TAG_vmtx HB_TAG('v','m','t','x')
HB_INTERNAL int
hb_ot_get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
HB_INTERNAL unsigned
hb_ot_get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
namespace OT {
@ -53,11 +60,6 @@ struct LongMetric
DEFINE_SIZE_STATIC (4);
};
struct hmtxvmtx_accelerator_base_t
{
HB_INTERNAL static int get_side_bearing_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
HB_INTERNAL static unsigned int get_advance_var_tt (hb_font_t *font, hb_codepoint_t glyph, bool is_vertical);
};
template <typename T, typename H>
struct hmtxvmtx
@ -156,7 +158,7 @@ struct hmtxvmtx
return_trace (true);
}
struct accelerator_t : hmtxvmtx_accelerator_base_t
struct accelerator_t
{
friend struct hmtxvmtx;
@ -213,7 +215,7 @@ struct hmtxvmtx
return side_bearing;
if (var_table.get_blob () == &Null (hb_blob_t))
return get_side_bearing_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
return hb_ot_get_side_bearing_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
return side_bearing + var_table->get_side_bearing_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
}
@ -243,7 +245,7 @@ struct hmtxvmtx
return advance;
if (var_table.get_blob () == &Null (hb_blob_t))
return get_advance_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
return hb_ot_get_advance_var_tt (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
return advance + roundf (var_table->get_advance_var (glyph, font->coords, font->num_coords)); // TODO Optimize?!
}