[style] Remove fdsc support (#2541)

It isn't exposed yet and low use between Apple fonts,
32 fdsc table vs 767 OS/2 tables, even Apple doesn't
support it anymore per Ned.
This commit is contained in:
Ebrahim Byagowi 2020-07-06 00:05:21 +04:30 committed by GitHub
parent 6a50aa4e54
commit a3b9b94b63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 0 additions and 164 deletions

View File

@ -1,7 +1,6 @@
# Base and default-included sources and headers
HB_BASE_sources = \
hb-aat-fdsc-table.hh \
hb-aat-layout-ankr-table.hh \
hb-aat-layout-bsln-table.hh \
hb-aat-layout-common.hh \

View File

@ -1,126 +0,0 @@
/*
* Copyright © 2018 Ebrahim Byagowi
*
* 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.
*/
#ifndef HB_AAT_FDSC_TABLE_HH
#define HB_AAT_FDSC_TABLE_HH
#include "hb-aat-layout-common.hh"
#include "hb-open-type.hh"
/*
* fdsc -- Font descriptors
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fdsc.html
*/
#define HB_AAT_TAG_fdsc HB_TAG('f','d','s','c')
namespace AAT {
struct FontDescriptor
{
bool has_data () const { return tag; }
int cmp (hb_tag_t a) const { return tag.cmp (a); }
float get_value () const { return u.value.to_float (); }
enum non_alphabetic_value_t {
Alphabetic = 0,
Dingbats = 1,
PiCharacters = 2,
Fleurons = 3,
DecorativeBorders = 4,
InternationalSymbols= 5,
MathSymbols = 6
};
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this));
}
protected:
Tag tag; /* The 4-byte table tag name. */
union {
HBFixed value; /* The value for the descriptor tag. */
HBUINT32 nalfType; /* If the tag is `nalf`, see non_alphabetic_value_t */
} u;
public:
DEFINE_SIZE_STATIC (8);
};
struct fdsc
{
static constexpr hb_tag_t tableTag = HB_AAT_TAG_fdsc;
enum {
Weight = HB_TAG ('w','g','h','t'),
/* Percent weight relative to regular weight.
* (defaul value: 1.0) */
Width = HB_TAG ('w','d','t','h'),
/* Percent width relative to regular width.
* (default value: 1.0) */
Slant = HB_TAG ('s','l','n','t'),
/* Angle of slant in degrees, where positive
* is clockwise from straight up.
* (default value: 0.0) */
OpticalSize = HB_TAG ('o','p','s','z'),
/* Point size the font was designed for.
* (default value: 12.0) */
NonAlphabetic= HB_TAG ('n','a','l','f')
/* These values are treated as integers,
* not fixed32s. 0 means alphabetic, and greater
* integers mean the font is non-alphabetic (e.g. symbols).
* (default value: 0) */
};
const FontDescriptor &get_descriptor (hb_tag_t style) const
{ return descriptors.lsearch (style); }
bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
descriptors.sanitize (c));
}
protected:
HBFixed version; /* Version number of the font descriptors
* table (0x00010000 for the current version). */
LArrayOf<FontDescriptor>
descriptors; /* List of tagged-coordinate pairs style descriptors
* that will be included to characterize this font.
* Each descriptor consists of a <tag, value> pair.
* These pairs are located in the gxFontDescriptor
* array that follows. */
public:
DEFINE_SIZE_ARRAY (8, descriptors);
};
} /* namespace AAT */
#endif /* HB_AAT_FDSC_TABLE_HH */

View File

@ -28,7 +28,6 @@
#include "hb.hh"
#include "hb-aat-layout.hh"
#include "hb-aat-fdsc-table.hh" // Just so we compile it; unused otherwise.
#include "hb-aat-layout-ankr-table.hh"
#include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise.
#include "hb-aat-layout-feat-table.hh"

View File

@ -60,7 +60,6 @@ HB_OT_ACCELERATOR (OT, post)
HB_OT_ACCELERATOR (OT, name)
#endif
#ifndef HB_NO_STYLE
HB_OT_TABLE (AAT, fdsc)
HB_OT_TABLE (OT, STAT)
#endif
#ifndef HB_NO_META

View File

@ -27,7 +27,6 @@
#ifndef HB_NO_STYLE
#ifdef HB_EXPERIMENTAL_API
#include "hb-aat-fdsc-table.hh"
#include "hb-ot-var-avar-table.hh"
#include "hb-ot-var-fvar-table.hh"
#include "hb-ot-stat-table.hh"
@ -106,19 +105,6 @@ hb_style_get_value (hb_font_t *font, hb_tag_t tag)
if (face->table.STAT->get_value (style_tag, &value))
return value;
/* Check Apple's fdsc as OS2 table is optional in AAT */
const AAT::FontDescriptor &descriptor = face->table.fdsc->get_descriptor (style_tag);
if (descriptor.has_data ())
{
float value = descriptor.get_value ();
/* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fdsc.html */
/* Percent weight relative to regular weight. */
if (style_tag == HB_STYLE_TAG_WEIGHT) value *= 400.f;
/* Percent width relative to regular width. */
if (style_tag == HB_STYLE_TAG_WIDTH) value *= 100.f;
return value;
}
switch ((unsigned) style_tag)
{
case HB_STYLE_TAG_ITALIC:

View File

@ -1,6 +1,5 @@
# Base and default-included sources and headers
hb_base_sources = files(
'hb-aat-fdsc-table.hh',
'hb-aat-layout-ankr-table.hh',
'hb-aat-layout-bsln-table.hh',
'hb-aat-layout-common.hh',

Binary file not shown.

View File

@ -65,25 +65,6 @@ test_regular_face (void)
hb_face_destroy (face);
}
static void
test_face_fdsc (void)
{
hb_face_t *face = hb_test_open_font_file ("fonts/aat-fdsc.ttf");
hb_font_t *font = hb_font_create (face);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_ITALIC), 0);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_OPTICAL_SIZE), 24);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_SLANT), 6.33f);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WIDTH), 100);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_WEIGHT), 400);
hb_font_set_ptem (font, 36);
assert_cmpfloat (hb_style_get_value (font, HB_STYLE_TAG_OPTICAL_SIZE), 36);
hb_font_destroy (font);
hb_face_destroy (face);
}
static void
test_face_user_setting (void)
{
@ -180,7 +161,6 @@ main (int argc, char **argv)
hb_test_add (test_empty_face);
hb_test_add (test_regular_face);
hb_test_add (test_face_fdsc);
hb_test_add (test_face_user_setting);
return hb_test_run ();