mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 06:21:16 +01:00
[ot] Add hb_ot_fetch_bits()
For fetching various bit fields scattered around OpenType tables. Many of these are legacy or unreliable, but applications might need them for various legacy reasons. Fixes https://github.com/harfbuzz/harfbuzz/issues/1920
This commit is contained in:
1 parent
9d7bba088a
commit
6e67c5feed
13 files changed
+343
No files matched your search
@@ -85,6 +85,7 @@
|
||||
<xi:include href="xml/hb-ot-name.xml"/>
|
||||
<xi:include href="xml/hb-ot-shape.xml"/>
|
||||
<xi:include href="xml/hb-ot-var.xml"/>
|
||||
<xi:include href="xml/hb-ot-fetch.xml"/>
|
||||
</chapter>
|
||||
|
||||
<chapter id="apple-advanced-typography-api">
|
||||
|
||||
@@ -834,6 +834,12 @@ hb_ot_var_axis_flags_t
|
||||
hb_ot_var_axis_info_t
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>hb-ot-fetch</FILE>
|
||||
hb_ot_bits_tag_t
|
||||
hb_ot_fetch_bits
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>hb-set</FILE>
|
||||
hb_set_create
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "hb-ot-cff2-table.cc"
|
||||
#include "hb-ot-color.cc"
|
||||
#include "hb-ot-face.cc"
|
||||
#include "hb-ot-fetch.cc"
|
||||
#include "hb-ot-font.cc"
|
||||
#include "hb-ot-layout.cc"
|
||||
#include "hb-ot-map.cc"
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "hb-ot-cff2-table.cc"
|
||||
#include "hb-ot-color.cc"
|
||||
#include "hb-ot-face.cc"
|
||||
#include "hb-ot-fetch.cc"
|
||||
#include "hb-ot-font.cc"
|
||||
#include "hb-ot-layout.cc"
|
||||
#include "hb-ot-map.cc"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "hb-ot-cff2-table.cc"
|
||||
#include "hb-ot-color.cc"
|
||||
#include "hb-ot-face.cc"
|
||||
#include "hb-ot-fetch.cc"
|
||||
#include "hb-ot-font.cc"
|
||||
#include "hb-ot-layout.cc"
|
||||
#include "hb-ot-map.cc"
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#define HB_NO_MMAP
|
||||
#define HB_NO_NAME
|
||||
#define HB_NO_OPEN
|
||||
#define HB_NO_OT_FETCH
|
||||
#define HB_NO_OT_FONT_GLYPH_NAMES
|
||||
#define HB_NO_SETLOCALE
|
||||
#define HB_NO_STYLE
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright © 2026 Khaled Hosny
|
||||
*
|
||||
* 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.hh"
|
||||
|
||||
#ifndef HB_NO_OT_FETCH
|
||||
|
||||
#include "hb-ot.h"
|
||||
|
||||
#include "hb-ot-head-table.hh"
|
||||
#include "hb-ot-os2-table.hh"
|
||||
#include "hb-ot-post-table.hh"
|
||||
|
||||
/**
|
||||
* SECTION:hb-ot-fetch
|
||||
* @title: hb-ot-fetch
|
||||
* @short_description: OpenType bit fields
|
||||
* @include: hb-ot.h
|
||||
*
|
||||
* Functions for fetching various bit fields scattered around OpenType tables.
|
||||
*
|
||||
* These are raw table values, and many of them are legacy or unreliable, but
|
||||
* applications might need them for various legacy reasons.
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* hb_ot_fetch_bits:
|
||||
* @face: #hb_face_t to work upon
|
||||
* @tag: tag of the bit field to fetch
|
||||
*
|
||||
* Fetches a bit field of @face.
|
||||
*
|
||||
* Return value: the bit field, or zero if the font does not have it.
|
||||
*
|
||||
* XSince: REPLACEME
|
||||
**/
|
||||
uint32_t
|
||||
hb_ot_fetch_bits (hb_face_t *face,
|
||||
hb_ot_bits_tag_t tag)
|
||||
{
|
||||
switch ((unsigned) tag)
|
||||
{
|
||||
case HB_OT_BITS_TAG_FS_TYPE: return face->table.OS2->fsType;
|
||||
case HB_OT_BITS_TAG_FS_SELECTION: return face->table.OS2->fsSelection;
|
||||
case HB_OT_BITS_TAG_MAC_STYLE: return face->table.head->get_mac_style ();
|
||||
case HB_OT_BITS_TAG_IS_FIXED_PITCH: return face->table.post->table->isFixedPitch;
|
||||
case HB_OT_BITS_TAG_UNICODE_RANGE_1: return face->table.OS2->ulUnicodeRange[0];
|
||||
case HB_OT_BITS_TAG_UNICODE_RANGE_2: return face->table.OS2->ulUnicodeRange[1];
|
||||
case HB_OT_BITS_TAG_UNICODE_RANGE_3: return face->table.OS2->ulUnicodeRange[2];
|
||||
case HB_OT_BITS_TAG_UNICODE_RANGE_4: return face->table.OS2->ulUnicodeRange[3];
|
||||
case HB_OT_BITS_TAG_CODE_PAGE_RANGE_1: return face->table.OS2->v1 ().ulCodePageRange1;
|
||||
case HB_OT_BITS_TAG_CODE_PAGE_RANGE_2: return face->table.OS2->v1 ().ulCodePageRange2;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright © 2026 Khaled Hosny
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if !defined(HB_OT_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
|
||||
#error "Include <hb-ot.h> instead."
|
||||
#endif
|
||||
|
||||
#ifndef HB_OT_FETCH_H
|
||||
#define HB_OT_FETCH_H
|
||||
|
||||
#include "hb.h"
|
||||
|
||||
HB_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* hb_ot_bits_tag_t:
|
||||
* @HB_OT_BITS_TAG_FS_TYPE: `fsType` of the `OS/2` table.
|
||||
* @HB_OT_BITS_TAG_FS_SELECTION: `fsSelection` of the `OS/2` table.
|
||||
* @HB_OT_BITS_TAG_MAC_STYLE: `macStyle` of the `head` table.
|
||||
* @HB_OT_BITS_TAG_IS_FIXED_PITCH: `isFixedPitch` of the `post` table.
|
||||
* @HB_OT_BITS_TAG_UNICODE_RANGE_1: `ulUnicodeRange1` of the `OS/2` table.
|
||||
* @HB_OT_BITS_TAG_UNICODE_RANGE_2: `ulUnicodeRange2` of the `OS/2` table.
|
||||
* @HB_OT_BITS_TAG_UNICODE_RANGE_3: `ulUnicodeRange3` of the `OS/2` table.
|
||||
* @HB_OT_BITS_TAG_UNICODE_RANGE_4: `ulUnicodeRange4` of the `OS/2` table.
|
||||
* @HB_OT_BITS_TAG_CODE_PAGE_RANGE_1: `ulCodePageRange1` of the `OS/2` table.
|
||||
* @HB_OT_BITS_TAG_CODE_PAGE_RANGE_2: `ulCodePageRange2` of the `OS/2` table.
|
||||
*
|
||||
* Bit fields that can be fetched with hb_ot_fetch_bits().
|
||||
*
|
||||
* XSince: REPLACEME
|
||||
**/
|
||||
typedef enum {
|
||||
HB_OT_BITS_TAG_FS_TYPE = HB_TAG ('f','s','t','p'),
|
||||
HB_OT_BITS_TAG_FS_SELECTION = HB_TAG ('f','s','s','l'),
|
||||
HB_OT_BITS_TAG_MAC_STYLE = HB_TAG ('m','c','s','t'),
|
||||
HB_OT_BITS_TAG_IS_FIXED_PITCH = HB_TAG ('f','x','p','t'),
|
||||
HB_OT_BITS_TAG_UNICODE_RANGE_1 = HB_TAG ('u','r','n','1'),
|
||||
HB_OT_BITS_TAG_UNICODE_RANGE_2 = HB_TAG ('u','r','n','2'),
|
||||
HB_OT_BITS_TAG_UNICODE_RANGE_3 = HB_TAG ('u','r','n','3'),
|
||||
HB_OT_BITS_TAG_UNICODE_RANGE_4 = HB_TAG ('u','r','n','4'),
|
||||
HB_OT_BITS_TAG_CODE_PAGE_RANGE_1 = HB_TAG ('c','p','r','1'),
|
||||
HB_OT_BITS_TAG_CODE_PAGE_RANGE_2 = HB_TAG ('c','p','r','2'),
|
||||
|
||||
/*< private >*/
|
||||
_HB_OT_BITS_TAG_MAX_VALUE = HB_TAG_MAX_SIGNED /*< skip >*/
|
||||
} hb_ot_bits_tag_t;
|
||||
|
||||
|
||||
HB_EXTERN uint32_t
|
||||
hb_ot_fetch_bits (hb_face_t *face,
|
||||
hb_ot_bits_tag_t tag);
|
||||
|
||||
HB_END_DECLS
|
||||
|
||||
#endif /* HB_OT_FETCH_H */
|
||||
@@ -99,6 +99,8 @@ struct head
|
||||
bool is_condensed () const { return macStyle & CONDENSED; }
|
||||
bool is_expanded () const { return macStyle & EXPANDED; }
|
||||
|
||||
unsigned get_mac_style () const { return macStyle; }
|
||||
|
||||
bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
#include "hb.h"
|
||||
|
||||
#include "hb-ot-fetch.h"
|
||||
#include "hb-ot-color.h"
|
||||
#include "hb-ot-deprecated.h"
|
||||
#include "hb-ot-font.h"
|
||||
|
||||
@@ -92,6 +92,7 @@ hb_base_sources = files(
|
||||
'hb-ot-face-table-list.hh',
|
||||
'hb-ot-face.cc',
|
||||
'hb-ot-face.hh',
|
||||
'hb-ot-fetch.cc',
|
||||
'hb-ot-font.cc',
|
||||
'hb-ot-gasp-table.hh',
|
||||
'hb-ot-glyf-table.hh',
|
||||
@@ -313,6 +314,7 @@ hb_base_headers = files(
|
||||
'hb-map.h',
|
||||
'hb-ot-color.h',
|
||||
'hb-ot-deprecated.h',
|
||||
'hb-ot-fetch.h',
|
||||
'hb-ot-font.h',
|
||||
'hb-ot-layout.h',
|
||||
'hb-ot-math.h',
|
||||
|
||||
@@ -30,6 +30,7 @@ tests = [
|
||||
'test-ot-collect-glyphs.c',
|
||||
'test-ot-color.c',
|
||||
'test-ot-face.c',
|
||||
'test-ot-fetch.c',
|
||||
'test-ot-glyphname.c',
|
||||
'test-ot-layout.c',
|
||||
'test-ot-ligature-carets.c',
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright © 2026 Khaled Hosny
|
||||
*
|
||||
* 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-test.h"
|
||||
|
||||
#include <hb-ot.h>
|
||||
|
||||
/* Unit tests for hb-ot-fetch.h */
|
||||
|
||||
static void
|
||||
test_ot_bits_fs_type (void)
|
||||
{
|
||||
hb_face_t *adwaita = hb_test_open_font_file ("fonts/adwaita.ttf");
|
||||
hb_face_t *zycon = hb_test_open_font_file ("fonts/Zycon.ttf");
|
||||
hb_face_t *abc = hb_test_open_font_file ("fonts/SourceSansPro-Regular.abc.otf");
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (adwaita, HB_OT_BITS_TAG_FS_TYPE), ==,
|
||||
0x0004u);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (zycon, HB_OT_BITS_TAG_FS_TYPE), ==, 1);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (abc, HB_OT_BITS_TAG_FS_TYPE), ==,
|
||||
0x0000u);
|
||||
|
||||
hb_face_destroy (abc);
|
||||
hb_face_destroy (zycon);
|
||||
hb_face_destroy (adwaita);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ot_bits_fs_selection (void)
|
||||
{
|
||||
hb_face_t *adwaita = hb_test_open_font_file ("fonts/adwaita.ttf");
|
||||
hb_face_t *bold = hb_test_open_font_file ("fonts/NotoSans-Bold.ttf");
|
||||
hb_face_t *italic = hb_test_open_font_file ("fonts/notosansitalic.ttf");
|
||||
hb_face_t *abc = hb_test_open_font_file ("fonts/SourceSansPro-Regular.abc.otf");
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (adwaita, HB_OT_BITS_TAG_FS_SELECTION), ==,
|
||||
0x0040u | 0x0080u);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (bold, HB_OT_BITS_TAG_FS_SELECTION), ==,
|
||||
0x0020u | 0x0080u);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (italic, HB_OT_BITS_TAG_FS_SELECTION), ==,
|
||||
0x0001u | 0x0100u);
|
||||
|
||||
/* USE_TYPO_METRICS */
|
||||
g_assert_true (hb_ot_fetch_bits (adwaita, HB_OT_BITS_TAG_FS_SELECTION)
|
||||
& 0x0080u);
|
||||
g_assert_false (hb_ot_fetch_bits (abc, HB_OT_BITS_TAG_FS_SELECTION)
|
||||
& 0x0080u);
|
||||
|
||||
hb_face_destroy (abc);
|
||||
hb_face_destroy (italic);
|
||||
hb_face_destroy (bold);
|
||||
hb_face_destroy (adwaita);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ot_bits_mac_style (void)
|
||||
{
|
||||
hb_face_t *bold = hb_test_open_font_file ("fonts/NotoSans-Bold.ttf");
|
||||
hb_face_t *italic = hb_test_open_font_file ("fonts/notosansitalic.ttf");
|
||||
hb_face_t *adwaita = hb_test_open_font_file ("fonts/adwaita.ttf");
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (bold, HB_OT_BITS_TAG_MAC_STYLE), ==,
|
||||
0x0001u);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (italic, HB_OT_BITS_TAG_MAC_STYLE), ==,
|
||||
0x0002u);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (adwaita, HB_OT_BITS_TAG_MAC_STYLE), ==, 0);
|
||||
|
||||
hb_face_destroy (adwaita);
|
||||
hb_face_destroy (italic);
|
||||
hb_face_destroy (bold);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ot_bits_is_fixed_pitch (void)
|
||||
{
|
||||
hb_face_t *mono = hb_test_open_font_file ("fonts/Inconsolata-Regular.abc.ttf");
|
||||
hb_face_t *adwaita = hb_test_open_font_file ("fonts/adwaita.ttf");
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (mono, HB_OT_BITS_TAG_IS_FIXED_PITCH), !=, 0);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (adwaita, HB_OT_BITS_TAG_IS_FIXED_PITCH), ==, 0);
|
||||
|
||||
hb_face_destroy (adwaita);
|
||||
hb_face_destroy (mono);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ot_bits_ranges (void)
|
||||
{
|
||||
hb_face_t *bold = hb_test_open_font_file ("fonts/NotoSans-Bold.ttf");
|
||||
hb_face_t *mplus = hb_test_open_font_file ("fonts/Mplus1p-Regular.ttf");
|
||||
hb_face_t *zycon = hb_test_open_font_file ("fonts/Zycon.ttf");
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (bold, HB_OT_BITS_TAG_UNICODE_RANGE_1), ==, 0xE00002FFu);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (bold, HB_OT_BITS_TAG_UNICODE_RANGE_2), ==, 0x4000201Fu);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (bold, HB_OT_BITS_TAG_UNICODE_RANGE_3), ==, 0x08000029u);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (bold, HB_OT_BITS_TAG_UNICODE_RANGE_4), ==, 0x00100000u);
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (mplus, HB_OT_BITS_TAG_CODE_PAGE_RANGE_1), ==, 0x601201BFu);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (mplus, HB_OT_BITS_TAG_CODE_PAGE_RANGE_2), ==, 0xDFF70000u);
|
||||
|
||||
/* OS/2 v0 does not have code page ranges */
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (zycon, HB_OT_BITS_TAG_CODE_PAGE_RANGE_1), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (zycon, HB_OT_BITS_TAG_CODE_PAGE_RANGE_2), ==, 0);
|
||||
|
||||
hb_face_destroy (zycon);
|
||||
hb_face_destroy (mplus);
|
||||
hb_face_destroy (bold);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ot_bits_missing_tables (void)
|
||||
{
|
||||
/* No OS/2 or post tables */
|
||||
hb_face_t *face = hb_test_open_font_file ("fonts/meta.ttf");
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (face, HB_OT_BITS_TAG_FS_TYPE), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (face, HB_OT_BITS_TAG_FS_SELECTION), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (face, HB_OT_BITS_TAG_IS_FIXED_PITCH), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (face, HB_OT_BITS_TAG_UNICODE_RANGE_1), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (face, HB_OT_BITS_TAG_CODE_PAGE_RANGE_1), ==, 0);
|
||||
|
||||
hb_face_destroy (face);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ot_bits_invalid (void)
|
||||
{
|
||||
hb_face_t *face = hb_test_open_font_file ("fonts/adwaita.ttf");
|
||||
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (face, (hb_ot_bits_tag_t) HB_TAG ('x','x','x','x')), ==, 0);
|
||||
g_assert_cmpuint (hb_ot_fetch_bits (hb_face_get_empty (), HB_OT_BITS_TAG_FS_TYPE), ==, 0);
|
||||
|
||||
hb_face_destroy (face);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
hb_test_init (&argc, &argv);
|
||||
|
||||
hb_test_add (test_ot_bits_fs_type);
|
||||
hb_test_add (test_ot_bits_fs_selection);
|
||||
hb_test_add (test_ot_bits_mac_style);
|
||||
hb_test_add (test_ot_bits_is_fixed_pitch);
|
||||
hb_test_add (test_ot_bits_ranges);
|
||||
hb_test_add (test_ot_bits_missing_tables);
|
||||
hb_test_add (test_ot_bits_invalid);
|
||||
|
||||
return hb_test_run ();
|
||||
}
|
||||
Reference in new issue
Block a user