[BASE] Minor

pull/838/head
Behdad Esfahbod 7 years ago
parent 05699fd996
commit 551fa2d200
  1. 1
      src/Makefile.sources
  2. 58
      src/hb-ot-base.cc
  3. 103
      src/hb-ot-layout-base-table.hh
  4. 34
      src/hb-ot-layout.cc
  5. 1
      src/hb-ot-layout.h

@ -87,7 +87,6 @@ HB_OT_sources = \
hb-aat-layout-kerx-table.hh \ hb-aat-layout-kerx-table.hh \
hb-aat-layout-trak-table.hh \ hb-aat-layout-trak-table.hh \
hb-aat-layout-private.hh \ hb-aat-layout-private.hh \
hb-ot-base.cc \
hb-ot-font.cc \ hb-ot-font.cc \
hb-ot-layout.cc \ hb-ot-layout.cc \
hb-ot-layout-base-table.hh \ hb-ot-layout-base-table.hh \

@ -1,58 +0,0 @@
/*
* Copyright © 2017 Elie Roux<elie.roux@telecom-bretagne.eu>
*
* 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.
*
*/
#include "hb-open-type-private.hh"
#include "hb-ot-layout-private.hh"
#include "hb-ot-layout-base-table.hh"
static inline const OT::BASE&
_get_base (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::BASE);
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
return *(layout->base.get ());
}
/*
* OT::BASE
*/
/**
* hb_ot_base_has_data:
* @face: #hb_face_t to test
*
* This function allows to verify the presence of an OpenType BASE table on the
* face.
*
* Return value: true if face has a BASE table, false otherwise
*
* Since: XXX
**/
hb_bool_t
hb_ot_base_has_data (hb_face_t *face)
{
return &_get_base (face) != &OT::Null(OT::BASE);
}

@ -221,40 +221,39 @@ struct MinMax {
}; };
struct BaseLangSysRecord { struct BaseLangSysRecord
{
inline Tag get_tag(void) const inline Tag get_tag(void) const
{ return baseLangSysTag; } { return baseLangSysTag; }
inline unsigned int get_feature_tag_index (Tag featureTableTag) const inline unsigned int get_feature_tag_index (Tag featureTableTag) const
{ (this+minMax).get_feature_tag_index(featureTableTag); } { return (this+minMax).get_feature_tag_index(featureTableTag); }
inline HBINT16 get_min_value (unsigned int featureTableTagIndex) const inline HBINT16 get_min_value (unsigned int featureTableTagIndex) const
{ (this+minMax).get_min_value(featureTableTagIndex); } { return (this+minMax).get_min_value(featureTableTagIndex); }
inline HBINT16 get_max_value (unsigned int featureTableTagIndex) const inline HBINT16 get_max_value (unsigned int featureTableTagIndex) const
{ (this+minMax).get_max_value(featureTableTagIndex); } { return (this+minMax).get_max_value(featureTableTagIndex); }
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{ {
TRACE_SANITIZE (this); TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && return_trace (c->check_struct (this) &&
minMax != Null(OffsetTo<MinMax>) && minMax != Null(OffsetTo<MinMax>) &&
minMax.sanitize (c, base)); minMax.sanitize (c, base));
} }
protected: protected:
Tag baseLangSysTag; Tag baseLangSysTag;
OffsetTo<MinMax> minMax; // not supposed to be NULL OffsetTo<MinMax> minMax;
public: public:
DEFINE_SIZE_STATIC (6); DEFINE_SIZE_STATIC (6);
}; };
struct BaseValues { struct BaseValues
{
inline const unsigned int get_default_base_tag_index (void) const inline unsigned int get_default_base_tag_index (void) const
{ return defaultIndex; } { return defaultIndex; }
inline HBINT16 get_base_coord (unsigned int baselineTagIndex) const inline HBINT16 get_base_coord (unsigned int baselineTagIndex) const
@ -272,10 +271,9 @@ struct BaseValues {
} }
protected: protected:
Index defaultIndex; Index defaultIndex;
HBUINT16 baseCoordCount; HBUINT16 baseCoordCount;
OffsetArrayOf<BaseCoord> baseCoords; OffsetArrayOf<BaseCoord> baseCoords;
public: public:
DEFINE_SIZE_ARRAY (6, baseCoords); DEFINE_SIZE_ARRAY (6, baseCoords);
@ -711,26 +709,66 @@ struct BASE
inline unsigned int get_horiz_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const inline unsigned int get_horiz_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const
{ return u.format1_0.get_horiz_lang_tag_index(baseScriptIndex, baseLangSysTag); } { return u.format1_0.get_horiz_lang_tag_index(baseScriptIndex, baseLangSysTag); }
inline unsigned int get_horiz_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const inline unsigned int get_horiz_feature_tag_index (unsigned int baseScriptIndex,
{ return u.format1_0.get_horiz_feature_tag_index(baseScriptIndex, baseLangSysIndex, featureTableTag); } unsigned int baseLangSysIndex,
Tag featureTableTag) const
{
return u.format1_0.get_horiz_feature_tag_index (baseScriptIndex,
baseLangSysIndex,
featureTableTag);
}
inline HBINT16 get_horiz_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const inline HBINT16 get_horiz_max_value (unsigned int baseScriptIndex,
{ return u.format1_0.get_horiz_max_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); } unsigned int baseLangSysIndex,
unsigned int featureTableTagIndex) const
{
return u.format1_0.get_horiz_max_value (baseScriptIndex,
baseLangSysIndex,
featureTableTagIndex);
}
inline HBINT16 get_horiz_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const inline HBINT16 get_horiz_min_value (unsigned int baseScriptIndex,
{ return u.format1_0.get_horiz_min_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); } unsigned int baseLangSysIndex,
unsigned int featureTableTagIndex) const
{
return u.format1_0.get_horiz_min_value (baseScriptIndex,
baseLangSysIndex,
featureTableTagIndex);
}
inline unsigned int get_vert_lang_tag_index (unsigned int baseScriptIndex, Tag baseLangSysTag) const inline unsigned int get_vert_lang_tag_index (unsigned int baseScriptIndex,
{ return u.format1_0.get_vert_lang_tag_index(baseScriptIndex, baseLangSysTag); } Tag baseLangSysTag) const
{
return u.format1_0.get_vert_lang_tag_index (baseScriptIndex,
baseLangSysTag);
}
inline unsigned int get_vert_feature_tag_index (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, Tag featureTableTag) const inline unsigned int get_vert_feature_tag_index (unsigned int baseScriptIndex,
{ return u.format1_0.get_vert_feature_tag_index(baseScriptIndex, baseLangSysIndex, featureTableTag); } unsigned int baseLangSysIndex,
Tag featureTableTag) const
{
return u.format1_0.get_vert_feature_tag_index (baseScriptIndex,
baseLangSysIndex,
featureTableTag);
}
inline HBINT16 get_vert_max_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const inline HBINT16 get_vert_max_value (unsigned int baseScriptIndex,
{ return u.format1_0.get_vert_max_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); } unsigned int baseLangSysIndex,
unsigned int featureTableTagIndex) const
{
return u.format1_0.get_vert_max_value (baseScriptIndex,
baseLangSysIndex,
featureTableTagIndex);
}
inline HBINT16 get_vert_min_value (unsigned int baseScriptIndex, unsigned int baseLangSysIndex, unsigned int featureTableTagIndex) const inline HBINT16 get_vert_min_value (unsigned int baseScriptIndex,
{ return u.format1_0.get_vert_min_value(baseScriptIndex, baseLangSysIndex, featureTableTagIndex); } unsigned int baseLangSysIndex,
unsigned int featureTableTagIndex) const
{
return u.format1_0.get_vert_min_value (baseScriptIndex,
baseLangSysIndex,
featureTableTagIndex);
}
inline bool sanitize (hb_sanitize_context_t *c) const inline bool sanitize (hb_sanitize_context_t *c) const
{ {
@ -750,7 +788,6 @@ struct BASE
BASEFormat1_0 format1_0; BASEFormat1_0 format1_0;
BASEFormat1_1 format1_1; BASEFormat1_1 format1_1;
} u; } u;
public: public:
DEFINE_SIZE_UNION (4, version); DEFINE_SIZE_UNION (4, version);
}; };

@ -222,6 +222,14 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
free (layout); free (layout);
} }
static inline const OT::BASE&
_get_base (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::BASE);
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
return *(layout->base.get ());
}
static inline const OT::GDEF& static inline const OT::GDEF&
_get_gdef (hb_face_t *face) _get_gdef (hb_face_t *face)
{ {
@ -1267,3 +1275,29 @@ hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c,
{ {
apply_string<GSUBProxy> (c, lookup, accel); apply_string<GSUBProxy> (c, lookup, accel);
} }
/*
* OT::BASE
*/
#if 0
/**
* hb_ot_base_has_data:
* @face: #hb_face_t to test
*
* This function allows to verify the presence of an OpenType BASE table on the
* face.
*
* Return value: true if face has a BASE table, false otherwise
*
* Since: XXX
**/
hb_bool_t
hb_ot_base_has_data (hb_face_t *face)
{
return &_get_base (face) != &OT::Null(OT::BASE);
}
#endif

@ -38,6 +38,7 @@
HB_BEGIN_DECLS HB_BEGIN_DECLS
#define HB_OT_TAG_BASE HB_TAG('B','A','S','E')
#define HB_OT_TAG_GDEF HB_TAG('G','D','E','F') #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
#define HB_OT_TAG_GSUB HB_TAG('G','S','U','B') #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
#define HB_OT_TAG_GPOS HB_TAG('G','P','O','S') #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')

Loading…
Cancel
Save