From ee7610181cee5bbc0b5dc291228fbe032097bde4 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 3 Oct 2019 15:59:45 +0330 Subject: [PATCH] [hmtx] Use more conventional internal API style --- src/Makefile.sources | 1 - src/harfbuzz.cc | 1 - src/hb-ot-font.cc | 12 ++++++++++++ src/hb-ot-hmtx-table.cc | 42 ----------------------------------------- src/hb-ot-hmtx-table.hh | 18 ++++++++++-------- 5 files changed, 22 insertions(+), 52 deletions(-) delete mode 100644 src/hb-ot-hmtx-table.cc diff --git a/src/Makefile.sources b/src/Makefile.sources index 31cd31f89..911ee2f54 100644 --- a/src/Makefile.sources +++ b/src/Makefile.sources @@ -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 \ diff --git a/src/harfbuzz.cc b/src/harfbuzz.cc index 2aa5a7942..fe1c36023 100644 --- a/src/harfbuzz.cc +++ b/src/harfbuzz.cc @@ -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" diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 4b7446e62..283cfb689 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -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 diff --git a/src/hb-ot-hmtx-table.cc b/src/hb-ot-hmtx-table.cc deleted file mode 100644 index 93afd5610..000000000 --- a/src/hb-ot-hmtx-table.cc +++ /dev/null @@ -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); -} - -} diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index f5c094463..8a7395982 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -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 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?! }