зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland. r=merge a=merge on a CLOSED TREE
This commit is contained in:
Коммит
7a627826a6
|
@ -15,6 +15,7 @@ support-files =
|
|||
[browser_addBookmarkForFrame.js]
|
||||
[browser_bookmark_folder_moveability.js]
|
||||
[browser_bookmarklet_windowOpen.js]
|
||||
[browser_bookmarks_sidebar_search.js]
|
||||
support-files =
|
||||
pageopeningwindow.html
|
||||
[browser_bookmarkProperties_addFolderDefaultButton.js]
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* Test searching for bookmarks (by title and by tag) from the Bookmarks sidebar.
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
let sidebar = document.getElementById("sidebar");
|
||||
|
||||
const TEST_URI = "http://example.com/";
|
||||
const BOOKMARKS_COUNT = 4;
|
||||
|
||||
function assertBookmarks(searchValue) {
|
||||
let found = 0;
|
||||
|
||||
let searchBox = sidebar.contentDocument.getElementById("search-box");
|
||||
|
||||
ok(searchBox, "search box is in context");
|
||||
|
||||
searchBox.value = searchValue;
|
||||
searchBox.doCommand();
|
||||
|
||||
let tree = sidebar.contentDocument.getElementById("bookmarks-view");
|
||||
|
||||
for (let i = 0; i < tree.view.rowCount; i++) {
|
||||
let cellText = tree.view.getCellText(i, tree.columns.getColumnAt(0));
|
||||
|
||||
if (cellText.indexOf("example page") != -1) {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
||||
info("Reset the search");
|
||||
searchBox.value = "";
|
||||
searchBox.doCommand();
|
||||
|
||||
is(found, BOOKMARKS_COUNT, "found expected site");
|
||||
}
|
||||
|
||||
add_task(async function test() {
|
||||
// Add bookmarks and tags.
|
||||
for (let i = 0; i < BOOKMARKS_COUNT; i++) {
|
||||
let url = Services.io.newURI(TEST_URI + i);
|
||||
|
||||
await PlacesUtils.bookmarks.insert({
|
||||
url,
|
||||
title: "example page " + i,
|
||||
parentGuid: PlacesUtils.bookmarks.toolbarGuid
|
||||
});
|
||||
PlacesUtils.tagging.tagURI(url, ["test"]);
|
||||
}
|
||||
|
||||
await withSidebarTree("bookmarks", function() {
|
||||
// Search a bookmark by its title.
|
||||
assertBookmarks("example.com");
|
||||
// Search a bookmark by its tag.
|
||||
assertBookmarks("test");
|
||||
});
|
||||
|
||||
// Cleanup.
|
||||
await PlacesUtils.bookmarks.eraseEverything();
|
||||
});
|
|
@ -152,23 +152,6 @@ ifeq (WINNT,$(OS_ARCH))
|
|||
endif
|
||||
@echo 'repackaging done'
|
||||
|
||||
ifdef MOZ_UPDATER
|
||||
# Note that we want updater.ini to be in the top directory, not the browser/
|
||||
# subdirectory, because that's where the updater is installed and runs.
|
||||
libs:: $(call MERGE_FILE,updater/updater.ini) $(call mkdir_deps,$(DIST)/bin)
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
||||
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
|
||||
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
|
||||
$(FINAL_TARGET)/../updater.ini
|
||||
else
|
||||
cat $< | \
|
||||
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
|
||||
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
|
||||
$(FINAL_TARGET)/../updater.ini
|
||||
endif
|
||||
endif
|
||||
|
||||
ident:
|
||||
@printf 'fx_revision '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Generate updater.ini by doing some light substitution on the localized updater.ini input,
|
||||
# and appending the contents of updater_ini_append on Windows.
|
||||
|
||||
from __future__ import absolute_import, unicode_literals, print_function
|
||||
|
||||
import buildconfig
|
||||
import codecs
|
||||
import re
|
||||
import shutil
|
||||
|
||||
def main(output, updater_ini, updater_ini_append, locale=None):
|
||||
assert(locale is not None)
|
||||
fixup_re = re.compile('^(Info|Title)Text=')
|
||||
# updater.ini is always utf-8.
|
||||
with codecs.open(updater_ini, 'rb', 'utf_8') as f:
|
||||
for line in f:
|
||||
line = fixup_re.sub(r'\1=', line)
|
||||
line = line.replace('%MOZ_APP_DISPLAYNAME%', buildconfig.substs['MOZ_APP_DISPLAYNAME'])
|
||||
output.write(line)
|
||||
if buildconfig.substs['OS_TARGET'] == 'WINNT':
|
||||
# Also append the contents of `updater_ini_append`.
|
||||
with codecs.open(updater_ini_append, 'rb', 'utf_8') as f:
|
||||
shutil.copyfileobj(f, output)
|
|
@ -12,6 +12,19 @@ LOCALIZED_PP_FILES.defaults.preferences += ['en-US/firefox-l10n.js']
|
|||
if CONFIG['MOZ_CRASHREPORTER']:
|
||||
LOCALIZED_FILES += ['en-US/crashreporter/crashreporter-override.ini']
|
||||
|
||||
if CONFIG['MOZ_UPDATER']:
|
||||
LOCALIZED_GENERATED_FILES += ['updater.ini']
|
||||
updater = LOCALIZED_GENERATED_FILES['updater.ini']
|
||||
updater.script = 'generate_updater_ini.py'
|
||||
updater.inputs = [
|
||||
'en-US/updater/updater.ini',
|
||||
'../installer/windows/nsis/updater_append.ini',
|
||||
]
|
||||
# Yes, this is weird, but what can you do? This file doesn't want to be in the DIST_SUBDIR,
|
||||
# but we can't really move it to a different directory until we change how locale repacks
|
||||
# work.
|
||||
LOCALIZED_FILES['..'] += ['!updater.ini']
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Toolkit", "Build Config")
|
||||
|
||||
|
|
|
@ -3,21 +3,27 @@
|
|||
<title>Crash [@ nsFocusManager::GetCommonAncestor], part 2</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="file_504224.html" id="content"></iframe>
|
||||
<script>
|
||||
var src=document.getElementById('src');
|
||||
function oniframeload() {
|
||||
window.frames[0].location.reload();
|
||||
};
|
||||
</script>
|
||||
<iframe src="file_504224.html" id="content" onload="oniframeload();" ></iframe>
|
||||
<script>
|
||||
var src='file_504224.html';
|
||||
setInterval(function() {
|
||||
if (!document.getElementById('content')) {
|
||||
var x=document.createElement('iframe');
|
||||
var x = document.getElementById('content');
|
||||
if (!x) {
|
||||
x=document.createElement('iframe');
|
||||
x.src=src;
|
||||
x.id = 'content';
|
||||
document.body.appendChild(x);
|
||||
setTimeout(function() { window.focus(); document.documentElement.removeAttribute('class'); }, 100);
|
||||
} else {
|
||||
window.frames[0].location.reload();
|
||||
setTimeout(function() {
|
||||
window.focus();
|
||||
document.documentElement.removeAttribute('class');
|
||||
}, 100);
|
||||
}
|
||||
}, 500);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
Overview of changes leading to 1.7.2
|
||||
Monday, December 4, 2017
|
||||
====================================
|
||||
|
||||
- Optimize hb_set_add_range().
|
||||
- Misc fixes.
|
||||
- New API:
|
||||
hb_coretext_font_create()
|
||||
|
||||
|
||||
Overview of changes leading to 1.7.1
|
||||
Tuesday, November 14, 2017
|
||||
====================================
|
||||
|
@ -33,7 +43,7 @@ Monday, October 23nd, 2017
|
|||
|
||||
- Yesterday's release had a bad crasher; don't use it. That's what
|
||||
happens when one works on Sunday...
|
||||
https://github.com/behdad/harfbuzz/issues/578
|
||||
https://github.com/harfbuzz/harfbuzz/issues/578
|
||||
- Build fixes for FreeBSD and Chrome Android.
|
||||
|
||||
|
||||
|
@ -42,7 +52,7 @@ Sunday, October 22nd, 2017
|
|||
====================================
|
||||
|
||||
- Don't skip over COMBINING GRAPHEME JOINER when ligating, etc.
|
||||
To be refined: https://github.com/behdad/harfbuzz/issues/554
|
||||
To be refined: https://github.com/harfbuzz/harfbuzz/issues/554
|
||||
- Faster hb_set_t implementation.
|
||||
- Don't use deprecated ICU API.
|
||||
- Fix undefined-behavior in Myanmar shaper, introduced in 1.6.0
|
||||
|
@ -443,7 +453,7 @@ Tuesday, February 23, 2016
|
|||
- CoreText: Drastically speed up font initialization.
|
||||
- CoreText: Fix tiny leak.
|
||||
- Group ZWJ/ZWNJ with previous syllable under cluster-level=0.
|
||||
https://github.com/behdad/harfbuzz/issues/217
|
||||
https://github.com/harfbuzz/harfbuzz/issues/217
|
||||
- Add test/shaping/README.md about how to add tests to the suite.
|
||||
|
||||
|
||||
|
@ -459,8 +469,8 @@ Friday, February 19, 2016
|
|||
- Allow GPOS cursive connection on marks, and fix the interaction with
|
||||
mark attachment. This work resulted in some changes to how mark
|
||||
attachments work. See:
|
||||
https://github.com/behdad/harfbuzz/issues/211
|
||||
https://github.com/behdad/harfbuzz/commit/86c68c7a2c971efe8e35b1f1bd99401dc8b688d2
|
||||
https://github.com/harfbuzz/harfbuzz/issues/211
|
||||
https://github.com/harfbuzz/harfbuzz/commit/86c68c7a2c971efe8e35b1f1bd99401dc8b688d2
|
||||
- Graphite2 shaper: improved negative advance handling (eg. Nastaliq).
|
||||
- Add nmake-based build system for Windows.
|
||||
- Minor speedup.
|
||||
|
@ -501,7 +511,7 @@ Wednesday, November 26, 2015
|
|||
====================================
|
||||
|
||||
- Fix badly-broken fallback shaper that affected terminology.
|
||||
https://github.com/behdad/harfbuzz/issues/187
|
||||
https://github.com/harfbuzz/harfbuzz/issues/187
|
||||
- Fix y_scaling in Graphite shaper.
|
||||
- API changes:
|
||||
* An unset glyph_h_origin() function in font-funcs now (sensibly)
|
||||
|
@ -523,11 +533,11 @@ Wednesday, November 18, 2015
|
|||
====================================
|
||||
|
||||
- Implement 'stch' stretch feature for Syriac Abbreviation Mark.
|
||||
https://github.com/behdad/harfbuzz/issues/141
|
||||
https://github.com/harfbuzz/harfbuzz/issues/141
|
||||
- Disable use of decompose_compatibility() callback.
|
||||
- Implement "shaping" of various Unicode space characters, even
|
||||
if the font does not support them.
|
||||
https://github.com/behdad/harfbuzz/issues/153
|
||||
https://github.com/harfbuzz/harfbuzz/issues/153
|
||||
- If font does not support U+2011 NO-BREAK HYPHEN, fallback to
|
||||
U+2010 HYPHEN.
|
||||
- Changes resulting from libFuzzer continuous fuzzing:
|
||||
|
@ -550,7 +560,7 @@ Thursday, October 15, 2015
|
|||
- Revert default load-flags of fonts created using hb_ft_font_create()
|
||||
back to FT_LOAD_DEFAULT|FT_LOAD_NO_HINTING. This was changed in
|
||||
last release (1.0.5), but caused major issues, so revert.
|
||||
https://github.com/behdad/harfbuzz/issues/143
|
||||
https://github.com/harfbuzz/harfbuzz/issues/143
|
||||
|
||||
|
||||
Overview of changes leading to 1.0.5
|
||||
|
@ -558,7 +568,7 @@ Tuesday, October 13, 2015
|
|||
====================================
|
||||
|
||||
- Fix multiple memory access bugs discovered using libFuzzer.
|
||||
https://github.com/behdad/harfbuzz/issues/139
|
||||
https://github.com/harfbuzz/harfbuzz/issues/139
|
||||
Everyone should upgrade to this version as soon as possible.
|
||||
We now have continuous fuzzing set up, to avoid issues like
|
||||
these creeping in again.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[![Build Status](https://travis-ci.org/behdad/harfbuzz.svg)](https://travis-ci.org/behdad/harfbuzz)
|
||||
[![Build Status](https://ci.appveyor.com/api/projects/status/4oaq58ns2h0m2soa?svg=true)](https://ci.appveyor.com/project/behdad/harfbuzz)
|
||||
[![CircleCI](https://circleci.com/gh/behdad/harfbuzz.svg?style=svg)](https://circleci.com/gh/behdad/harfbuzz)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/behdad/harfbuzz.svg)](https://coveralls.io/r/behdad/harfbuzz)
|
||||
[![Build Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz)
|
||||
[![Build Status](https://ci.appveyor.com/api/projects/status/4oaq58ns2h0m2soa?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz)
|
||||
[![CircleCI](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz)
|
||||
[ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/)
|
||||
|
||||
This is HarfBuzz, a text shaping library.
|
||||
|
@ -11,3 +11,5 @@ For bug reports, mailing list, and other information please visit:
|
|||
http://harfbuzz.org/
|
||||
|
||||
For license information, see the file COPYING.
|
||||
|
||||
Documentation: https://harfbuzz.github.io
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
gfx/harfbuzz status as of 2017-11-14:
|
||||
gfx/harfbuzz status as of 2017-12-04:
|
||||
|
||||
This directory contains the HarfBuzz source from the 'master' branch of
|
||||
https://github.com/behdad/harfbuzz.
|
||||
|
||||
Current version: 1.7.1
|
||||
Current version: 1.7.2
|
||||
|
||||
UPDATING:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
AC_PREREQ([2.64])
|
||||
AC_INIT([HarfBuzz],
|
||||
[1.7.1],
|
||||
[https://github.com/behdad/harfbuzz/issues/new],
|
||||
[1.7.2],
|
||||
[https://github.com/harfbuzz/harfbuzz/issues/new],
|
||||
[harfbuzz],
|
||||
[http://harfbuzz.org/])
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<!--download-page
|
||||
rdf:resource=""/-->
|
||||
<bug-database
|
||||
rdf:resource="https://github.com/behdad/harfbuzz/issues" />
|
||||
rdf:resource="https://github.com/harfbuzz/harfbuzz/issues" />
|
||||
|
||||
<maintainer>
|
||||
<foaf:Person>
|
||||
|
|
|
@ -99,6 +99,9 @@ SUBDIRS += hb-ucdn
|
|||
HBCFLAGS += -I$(srcdir)/hb-ucdn
|
||||
HBLIBS += hb-ucdn/libhb-ucdn.la
|
||||
HBSOURCES += $(HB_UCDN_sources)
|
||||
hb-ucdn/libhb-ucdn.la: ucdn
|
||||
ucdn:
|
||||
@$(MAKE) $(AM_MAKEFLAGS) -C hb-ucdn
|
||||
endif
|
||||
DIST_SUBDIRS += hb-ucdn
|
||||
|
||||
|
@ -135,9 +138,12 @@ FUZZING_CPPFLAGS= \
|
|||
-DHB_NDEBUG \
|
||||
-DHB_MAX_NESTING_LEVEL=3 \
|
||||
-DHB_SANITIZE_MAX_EDITS=3 \
|
||||
-DHB_BUFFER_MAX_EXPANSION_FACTOR=3 \
|
||||
-DHB_BUFFER_MAX_LEN_FACTOR=3 \
|
||||
-DHB_BUFFER_MAX_LEN_MIN=8 \
|
||||
-DHB_BUFFER_MAX_LEN_DEFAULT=128 \
|
||||
-DHB_BUFFER_MAX_OPS_FACTOR=8 \
|
||||
-DHB_BUFFER_MAX_OPS_MIN=64 \
|
||||
-DHB_BUFFER_MAX_OPS_DEFAULT=1024 \
|
||||
$(NULL)
|
||||
EXTRA_LTLIBRARIES = libharfbuzz-fuzzing.la
|
||||
libharfbuzz_fuzzing_la_LINK = $(libharfbuzz_la_LINK)
|
||||
|
|
|
@ -44,6 +44,7 @@ defaults = ('Other', 'Not_Applicable', 'Cn', 'No_Block')
|
|||
# TODO Characters that are not in Unicode Indic files, but used in USE
|
||||
data[0][0x034F] = defaults[0]
|
||||
data[0][0x2060] = defaults[0]
|
||||
data[0][0x20F0] = defaults[0]
|
||||
for u in range (0xFE00, 0xFE0F + 1):
|
||||
data[0][u] = defaults[0]
|
||||
|
||||
|
@ -300,9 +301,15 @@ def map_to_use(data):
|
|||
# the nasalization marks, maybe only for U+1CE9..U+1CF1.
|
||||
if U == 0x1CED: UISC = Tone_Mark
|
||||
|
||||
# TODO: https://github.com/behdad/harfbuzz/issues/525
|
||||
# TODO: https://github.com/harfbuzz/harfbuzz/issues/525
|
||||
if U == 0x1A7F: UISC = Consonant_Final; UIPC = Bottom
|
||||
|
||||
# TODO: https://github.com/harfbuzz/harfbuzz/pull/609
|
||||
if U == 0x20F0: UISC = Cantillation_Mark; UIPC = Top
|
||||
|
||||
# TODO: https://github.com/harfbuzz/harfbuzz/pull/626
|
||||
if U == 0xA8B4: UISC = Consonant_Medial
|
||||
|
||||
values = [k for k,v in items if v(U,UISC,UGC)]
|
||||
assert len(values) == 1, "%s %s %s %s" % (hex(U), UISC, UGC, values)
|
||||
USE = values[0]
|
||||
|
|
|
@ -5,7 +5,7 @@ includedir=/usr/local/include
|
|||
|
||||
Name: harfbuzz
|
||||
Description: HarfBuzz text shaping library ICU integration
|
||||
Version: 1.7.1
|
||||
Version: 1.7.2
|
||||
|
||||
Requires: harfbuzz
|
||||
Requires.private: icu-uc
|
||||
|
|
|
@ -5,7 +5,7 @@ includedir=/usr/local/include
|
|||
|
||||
Name: harfbuzz
|
||||
Description: HarfBuzz text shaping library
|
||||
Version: 1.7.1
|
||||
Version: 1.7.2
|
||||
|
||||
Libs: -L${libdir} -lharfbuzz
|
||||
Libs.private: -lm
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
#include "hb-unicode-private.hh"
|
||||
|
||||
|
||||
#ifndef HB_BUFFER_MAX_EXPANSION_FACTOR
|
||||
#define HB_BUFFER_MAX_EXPANSION_FACTOR 32
|
||||
#ifndef HB_BUFFER_MAX_LEN_FACTOR
|
||||
#define HB_BUFFER_MAX_LEN_FACTOR 32
|
||||
#endif
|
||||
#ifndef HB_BUFFER_MAX_LEN_MIN
|
||||
#define HB_BUFFER_MAX_LEN_MIN 8192
|
||||
|
@ -45,6 +45,16 @@
|
|||
#define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */
|
||||
#endif
|
||||
|
||||
#ifndef HB_BUFFER_MAX_OPS_FACTOR
|
||||
#define HB_BUFFER_MAX_OPS_FACTOR 64
|
||||
#endif
|
||||
#ifndef HB_BUFFER_MAX_OPS_MIN
|
||||
#define HB_BUFFER_MAX_OPS_MIN 1024
|
||||
#endif
|
||||
#ifndef HB_BUFFER_MAX_OPS_DEFAULT
|
||||
#define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFFFFFF /* Shaping more than a billion operations? Let us know! */
|
||||
#endif
|
||||
|
||||
static_assert ((sizeof (hb_glyph_info_t) == 20), "");
|
||||
static_assert ((sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)), "");
|
||||
|
||||
|
@ -84,6 +94,7 @@ struct hb_buffer_t {
|
|||
hb_codepoint_t replacement; /* U+FFFD or something else. */
|
||||
hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */
|
||||
unsigned int max_len; /* Maximum allowed len. */
|
||||
int max_ops; /* Maximum allowed operations. */
|
||||
|
||||
/* Buffer contents */
|
||||
hb_buffer_content_type_t content_type;
|
||||
|
@ -102,17 +113,6 @@ struct hb_buffer_t {
|
|||
hb_glyph_info_t *out_info;
|
||||
hb_glyph_position_t *pos;
|
||||
|
||||
inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
|
||||
inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
|
||||
|
||||
inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
|
||||
inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
|
||||
|
||||
inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
|
||||
inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
|
||||
|
||||
inline bool has_separate_output (void) const { return info != out_info; }
|
||||
|
||||
unsigned int serial;
|
||||
|
||||
/* Text before / after the main buffer contents.
|
||||
|
@ -132,6 +132,10 @@ struct hb_buffer_t {
|
|||
#ifndef HB_NDEBUG
|
||||
uint8_t allocated_var_bits;
|
||||
#endif
|
||||
|
||||
|
||||
/* Methods */
|
||||
|
||||
inline void allocate_var (unsigned int start, unsigned int count)
|
||||
{
|
||||
#ifndef HB_NDEBUG
|
||||
|
@ -168,8 +172,17 @@ struct hb_buffer_t {
|
|||
#endif
|
||||
}
|
||||
|
||||
inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
|
||||
inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
|
||||
|
||||
inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
|
||||
inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
|
||||
|
||||
inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
|
||||
inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
|
||||
|
||||
inline bool has_separate_output (void) const { return info != out_info; }
|
||||
|
||||
/* Methods */
|
||||
|
||||
HB_INTERNAL void reset (void);
|
||||
HB_INTERNAL void clear (void);
|
||||
|
|
|
@ -722,6 +722,7 @@ hb_buffer_create (void)
|
|||
return hb_buffer_get_empty ();
|
||||
|
||||
buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
|
||||
buffer->max_ops = HB_BUFFER_MAX_OPS_DEFAULT;
|
||||
|
||||
buffer->reset ();
|
||||
|
||||
|
@ -749,6 +750,7 @@ hb_buffer_get_empty (void)
|
|||
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
|
||||
HB_BUFFER_SCRATCH_FLAG_DEFAULT,
|
||||
HB_BUFFER_MAX_LEN_DEFAULT,
|
||||
HB_BUFFER_MAX_OPS_DEFAULT,
|
||||
|
||||
HB_BUFFER_CONTENT_TYPE_INVALID,
|
||||
HB_SEGMENT_PROPERTIES_DEFAULT,
|
||||
|
|
|
@ -81,21 +81,12 @@ _hb_cg_font_release (void *data)
|
|||
CGFontRelease ((CGFontRef) data);
|
||||
}
|
||||
|
||||
hb_face_t *
|
||||
hb_coretext_face_create (CGFontRef cg_font)
|
||||
{
|
||||
return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
|
||||
}
|
||||
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face)
|
||||
HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
|
||||
fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size (font->ptem)) <= .5
|
||||
)
|
||||
|
||||
/*
|
||||
* shaper face data
|
||||
*/
|
||||
|
||||
static CTFontDescriptorRef
|
||||
get_last_resort_font_desc (void)
|
||||
{
|
||||
|
@ -267,6 +258,12 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
|
|||
CFRelease ((CGFontRef) data);
|
||||
}
|
||||
|
||||
hb_face_t *
|
||||
hb_coretext_face_create (CGFontRef cg_font)
|
||||
{
|
||||
return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
|
||||
}
|
||||
|
||||
/*
|
||||
* Since: 0.9.10
|
||||
*/
|
||||
|
@ -278,10 +275,6 @@ hb_coretext_face_get_cg_font (hb_face_t *face)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* shaper font data
|
||||
*/
|
||||
|
||||
hb_coretext_shaper_font_data_t *
|
||||
_hb_coretext_shaper_font_data_create (hb_font_t *font)
|
||||
{
|
||||
|
@ -306,6 +299,35 @@ _hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
|
|||
CFRelease ((CTFontRef) data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Since: 1.7.2
|
||||
*/
|
||||
hb_font_t *
|
||||
hb_coretext_font_create (CTFontRef ct_font)
|
||||
{
|
||||
CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, 0);
|
||||
hb_face_t *face = hb_coretext_face_create (cg_font);
|
||||
CFRelease (cg_font);
|
||||
hb_font_t *font = hb_font_create (face);
|
||||
hb_face_destroy (face);
|
||||
|
||||
if (unlikely (hb_object_is_inert (font)))
|
||||
return font;
|
||||
|
||||
/* Let there be dragons here... */
|
||||
HB_SHAPER_DATA_GET (font) = (hb_coretext_shaper_font_data_t *) CFRetain (ct_font);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
CTFontRef
|
||||
hb_coretext_font_get_ct_font (hb_font_t *font)
|
||||
{
|
||||
if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr;
|
||||
return (CTFontRef) HB_SHAPER_DATA_GET (font);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* shaper shape_plan data
|
||||
|
@ -328,13 +350,6 @@ _hb_coretext_shaper_shape_plan_data_destroy (hb_coretext_shaper_shape_plan_data_
|
|||
{
|
||||
}
|
||||
|
||||
CTFontRef
|
||||
hb_coretext_font_get_ct_font (hb_font_t *font)
|
||||
{
|
||||
if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr;
|
||||
return (CTFontRef)HB_SHAPER_DATA_GET (font);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* shaper
|
||||
|
@ -1000,7 +1015,7 @@ resize_and_retry:
|
|||
* However, even that wouldn't work if we were passed in the CGFont to
|
||||
* construct a hb_face to begin with.
|
||||
*
|
||||
* See: http://github.com/behdad/harfbuzz/pull/36
|
||||
* See: http://github.com/harfbuzz/harfbuzz/pull/36
|
||||
*
|
||||
* Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098
|
||||
*/
|
||||
|
|
|
@ -48,6 +48,9 @@ HB_BEGIN_DECLS
|
|||
HB_EXTERN hb_face_t *
|
||||
hb_coretext_face_create (CGFontRef cg_font);
|
||||
|
||||
HB_EXTERN hb_font_t *
|
||||
hb_coretext_font_create (CTFontRef ct_font);
|
||||
|
||||
|
||||
HB_EXTERN CGFontRef
|
||||
hb_coretext_face_get_cg_font (hb_face_t *face);
|
||||
|
|
|
@ -221,12 +221,14 @@ template <>
|
|||
|
||||
template <int max_level, typename ret_t>
|
||||
struct hb_auto_trace_t {
|
||||
|
||||
explicit inline hb_auto_trace_t (unsigned int *plevel_,
|
||||
const char *what_,
|
||||
const void *obj_,
|
||||
const char *func,
|
||||
const char *message,
|
||||
...) : plevel (plevel_), what (what_), obj (obj_), returned (false)
|
||||
...) HB_PRINTF_FUNC(6, 7)
|
||||
: plevel (plevel_), what (what_), obj (obj_), returned (false)
|
||||
{
|
||||
if (plevel) ++*plevel;
|
||||
|
||||
|
@ -270,7 +272,7 @@ template <typename ret_t> /* Make sure we don't use hb_auto_trace_t when not tra
|
|||
struct hb_auto_trace_t<0, ret_t>;
|
||||
|
||||
/* For disabled tracing; optimize out everything.
|
||||
* https://github.com/behdad/harfbuzz/pull/605 */
|
||||
* https://github.com/harfbuzz/harfbuzz/pull/605 */
|
||||
template <typename ret_t>
|
||||
struct hb_no_trace_t {
|
||||
inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; }
|
||||
|
@ -343,7 +345,7 @@ struct hb_no_trace_t {
|
|||
#define TRACE_CLOSURE(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_CLOSURE, hb_void_t> trace \
|
||||
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
|
||||
"")
|
||||
" ")
|
||||
#else
|
||||
#define TRACE_CLOSURE(this) hb_no_trace_t<hb_void_t> trace HB_UNUSED
|
||||
#endif
|
||||
|
@ -355,7 +357,7 @@ struct hb_no_trace_t {
|
|||
#define TRACE_COLLECT_GLYPHS(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_COLLECT_GLYPHS, hb_void_t> trace \
|
||||
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
|
||||
"")
|
||||
" ")
|
||||
#else
|
||||
#define TRACE_COLLECT_GLYPHS(this) hb_no_trace_t<hb_void_t> trace HB_UNUSED
|
||||
#endif
|
||||
|
@ -367,7 +369,7 @@ struct hb_no_trace_t {
|
|||
#define TRACE_SANITIZE(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \
|
||||
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
|
||||
"");
|
||||
" ");
|
||||
#else
|
||||
#define TRACE_SANITIZE(this) hb_no_trace_t<bool> trace
|
||||
#endif
|
||||
|
@ -379,7 +381,7 @@ struct hb_no_trace_t {
|
|||
#define TRACE_SERIALIZE(this) \
|
||||
hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \
|
||||
(&c->debug_depth, "SERIALIZE", c, HB_FUNC, \
|
||||
"");
|
||||
" ");
|
||||
#else
|
||||
#define TRACE_SERIALIZE(this) hb_no_trace_t<bool> trace
|
||||
#endif
|
||||
|
|
|
@ -64,9 +64,9 @@ typedef struct TableRecord
|
|||
|
||||
Tag tag; /* 4-byte identifier. */
|
||||
CheckSum checkSum; /* CheckSum for this table. */
|
||||
ULONG offset; /* Offset from beginning of TrueType font
|
||||
UINT32 offset; /* Offset from beginning of TrueType font
|
||||
* file. */
|
||||
ULONG length; /* Length of this table. */
|
||||
UINT32 length; /* Length of this table. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (16);
|
||||
} OpenTypeTable;
|
||||
|
@ -154,7 +154,7 @@ struct TTCHeaderVersion1
|
|||
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
|
||||
FixedVersion<>version; /* Version of the TTC Header (1.0),
|
||||
* 0x00010000u */
|
||||
ArrayOf<LOffsetTo<OffsetTable>, ULONG>
|
||||
ArrayOf<LOffsetTo<OffsetTable>, UINT32>
|
||||
table; /* Array of offsets to the OffsetTable for each font
|
||||
* from the beginning of the file */
|
||||
public:
|
||||
|
|
|
@ -635,23 +635,22 @@ struct IntType
|
|||
DEFINE_SIZE_STATIC (Size);
|
||||
};
|
||||
|
||||
typedef IntType<int8_t, 1> CHAR; /* 8-bit signed integer. */
|
||||
typedef IntType<uint8_t, 1> BYTE; /* 8-bit unsigned integer. */
|
||||
typedef IntType<uint8_t, 1> UINT8; /* 8-bit unsigned integer. */
|
||||
typedef IntType<int8_t, 1> INT8; /* 8-bit signed integer. */
|
||||
typedef IntType<uint16_t, 2> USHORT; /* 16-bit unsigned integer. */
|
||||
typedef IntType<int16_t, 2> SHORT; /* 16-bit signed integer. */
|
||||
typedef IntType<uint32_t, 4> ULONG; /* 32-bit unsigned integer. */
|
||||
typedef IntType<int32_t, 4> LONG; /* 32-bit signed integer. */
|
||||
typedef IntType<uint16_t, 2> UINT16; /* 16-bit unsigned integer. */
|
||||
typedef IntType<int16_t, 2> INT16; /* 16-bit signed integer. */
|
||||
typedef IntType<uint32_t, 4> UINT32; /* 32-bit unsigned integer. */
|
||||
typedef IntType<int32_t, 4> INT32; /* 32-bit signed integer. */
|
||||
typedef IntType<uint32_t, 3> UINT24; /* 24-bit unsigned integer. */
|
||||
|
||||
/* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */
|
||||
typedef SHORT FWORD;
|
||||
/* 16-bit signed integer (INT16) that describes a quantity in FUnits. */
|
||||
typedef INT16 FWORD;
|
||||
|
||||
/* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
|
||||
typedef USHORT UFWORD;
|
||||
/* 16-bit unsigned integer (UINT16) that describes a quantity in FUnits. */
|
||||
typedef UINT16 UFWORD;
|
||||
|
||||
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
|
||||
struct F2DOT14 : SHORT
|
||||
struct F2DOT14 : INT16
|
||||
{
|
||||
//inline float to_float (void) const { return ???; }
|
||||
//inline void set_float (float f) { v.set (f * ???); }
|
||||
|
@ -660,7 +659,7 @@ struct F2DOT14 : SHORT
|
|||
};
|
||||
|
||||
/* 32-bit signed fixed-point number (16.16). */
|
||||
struct Fixed: LONG
|
||||
struct Fixed: INT32
|
||||
{
|
||||
//inline float to_float (void) const { return ???; }
|
||||
//inline void set_float (float f) { v.set (f * ???); }
|
||||
|
@ -678,15 +677,15 @@ struct LONGDATETIME
|
|||
return_trace (likely (c->check_struct (this)));
|
||||
}
|
||||
protected:
|
||||
LONG major;
|
||||
ULONG minor;
|
||||
INT32 major;
|
||||
UINT32 minor;
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (8);
|
||||
};
|
||||
|
||||
/* Array of four uint8s (length = 32 bits) used to identify a script, language
|
||||
* system, feature, or baseline */
|
||||
struct Tag : ULONG
|
||||
struct Tag : UINT32
|
||||
{
|
||||
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
|
||||
inline operator const char* (void) const { return reinterpret_cast<const char *> (&this->v); }
|
||||
|
@ -697,16 +696,16 @@ struct Tag : ULONG
|
|||
DEFINE_NULL_DATA (Tag, " ");
|
||||
|
||||
/* Glyph index number, same as uint16 (length = 16 bits) */
|
||||
typedef USHORT GlyphID;
|
||||
typedef UINT16 GlyphID;
|
||||
|
||||
/* Script/language-system/feature index */
|
||||
struct Index : USHORT {
|
||||
struct Index : UINT16 {
|
||||
static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
|
||||
};
|
||||
DEFINE_NULL_DATA (Index, "\xff\xff");
|
||||
|
||||
/* Offset, Null offset = 0 */
|
||||
template <typename Type=USHORT>
|
||||
template <typename Type>
|
||||
struct Offset : Type
|
||||
{
|
||||
inline bool is_null (void) const { return 0 == *this; }
|
||||
|
@ -714,15 +713,18 @@ struct Offset : Type
|
|||
DEFINE_SIZE_STATIC (sizeof(Type));
|
||||
};
|
||||
|
||||
typedef Offset<UINT16> Offset16;
|
||||
typedef Offset<UINT32> Offset32;
|
||||
|
||||
|
||||
/* CheckSum */
|
||||
struct CheckSum : ULONG
|
||||
struct CheckSum : UINT32
|
||||
{
|
||||
/* This is reference implementation from the spec. */
|
||||
static inline uint32_t CalcTableChecksum (const ULONG *Table, uint32_t Length)
|
||||
static inline uint32_t CalcTableChecksum (const UINT32 *Table, uint32_t Length)
|
||||
{
|
||||
uint32_t Sum = 0L;
|
||||
const ULONG *EndPtr = Table+((Length+3) & ~3) / ULONG::static_size;
|
||||
const UINT32 *EndPtr = Table+((Length+3) & ~3) / UINT32::static_size;
|
||||
|
||||
while (Table < EndPtr)
|
||||
Sum += *Table++;
|
||||
|
@ -731,7 +733,7 @@ struct CheckSum : ULONG
|
|||
|
||||
/* Note: data should be 4byte aligned and have 4byte padding at the end. */
|
||||
inline void set_for_data (const void *data, unsigned int length)
|
||||
{ set (CalcTableChecksum ((const ULONG *) data, length)); }
|
||||
{ set (CalcTableChecksum ((const UINT32 *) data, length)); }
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
|
@ -742,7 +744,7 @@ struct CheckSum : ULONG
|
|||
* Version Numbers
|
||||
*/
|
||||
|
||||
template <typename FixedType=USHORT>
|
||||
template <typename FixedType=UINT16>
|
||||
struct FixedVersion
|
||||
{
|
||||
inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 8)) + minor; }
|
||||
|
@ -766,7 +768,7 @@ struct FixedVersion
|
|||
* Use: (base+offset)
|
||||
*/
|
||||
|
||||
template <typename Type, typename OffsetType=USHORT>
|
||||
template <typename Type, typename OffsetType=UINT16>
|
||||
struct OffsetTo : Offset<OffsetType>
|
||||
{
|
||||
inline const Type& operator () (const void *base) const
|
||||
|
@ -811,7 +813,7 @@ struct OffsetTo : Offset<OffsetType>
|
|||
}
|
||||
DEFINE_SIZE_STATIC (sizeof(OffsetType));
|
||||
};
|
||||
template <typename Type> struct LOffsetTo : OffsetTo<Type, ULONG> {};
|
||||
template <typename Type> struct LOffsetTo : OffsetTo<Type, UINT32> {};
|
||||
template <typename Base, typename OffsetType, typename Type>
|
||||
static inline const Type& operator + (const Base &base, const OffsetTo<Type, OffsetType> &offset) { return offset (base); }
|
||||
template <typename Base, typename OffsetType, typename Type>
|
||||
|
@ -823,7 +825,7 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType> &offset)
|
|||
*/
|
||||
|
||||
/* An array with a number of elements. */
|
||||
template <typename Type, typename LenType=USHORT>
|
||||
template <typename Type, typename LenType=UINT16>
|
||||
struct ArrayOf
|
||||
{
|
||||
const Type *sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const
|
||||
|
@ -933,10 +935,10 @@ struct ArrayOf
|
|||
public:
|
||||
DEFINE_SIZE_ARRAY (sizeof (LenType), array);
|
||||
};
|
||||
template <typename Type> struct LArrayOf : ArrayOf<Type, ULONG> {};
|
||||
template <typename Type> struct LArrayOf : ArrayOf<Type, UINT32> {};
|
||||
|
||||
/* Array of Offset's */
|
||||
template <typename Type, typename OffsetType=USHORT>
|
||||
template <typename Type, typename OffsetType=UINT16>
|
||||
struct OffsetArrayOf : ArrayOf<OffsetTo<Type, OffsetType> > {};
|
||||
|
||||
/* Array of offsets relative to the beginning of the array itself. */
|
||||
|
@ -964,7 +966,7 @@ struct OffsetListOf : OffsetArrayOf<Type>
|
|||
|
||||
|
||||
/* An array starting at second element. */
|
||||
template <typename Type, typename LenType=USHORT>
|
||||
template <typename Type, typename LenType=UINT16>
|
||||
struct HeadlessArrayOf
|
||||
{
|
||||
inline const Type& operator [] (unsigned int i) const
|
||||
|
@ -1026,7 +1028,7 @@ struct HeadlessArrayOf
|
|||
/*
|
||||
* An array with sorted elements. Supports binary searching.
|
||||
*/
|
||||
template <typename Type, typename LenType=USHORT>
|
||||
template <typename Type, typename LenType=UINT16>
|
||||
struct SortedArrayOf : ArrayOf<Type, LenType>
|
||||
{
|
||||
template <typename SearchType>
|
||||
|
@ -1065,10 +1067,10 @@ struct BinSearchHeader
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT len;
|
||||
USHORT searchRangeZ;
|
||||
USHORT entrySelectorZ;
|
||||
USHORT rangeShiftZ;
|
||||
UINT16 len;
|
||||
UINT16 searchRangeZ;
|
||||
UINT16 entrySelectorZ;
|
||||
UINT16 rangeShiftZ;
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (8);
|
||||
|
|
|
@ -47,20 +47,20 @@ struct SmallGlyphMetrics
|
|||
extents->height = -height;
|
||||
}
|
||||
|
||||
BYTE height;
|
||||
BYTE width;
|
||||
CHAR bearingX;
|
||||
CHAR bearingY;
|
||||
BYTE advance;
|
||||
UINT8 height;
|
||||
UINT8 width;
|
||||
INT8 bearingX;
|
||||
INT8 bearingY;
|
||||
UINT8 advance;
|
||||
|
||||
DEFINE_SIZE_STATIC(5);
|
||||
};
|
||||
|
||||
struct BigGlyphMetrics : SmallGlyphMetrics
|
||||
{
|
||||
CHAR vertBearingX;
|
||||
CHAR vertBearingY;
|
||||
BYTE vertAdvance;
|
||||
INT8 vertBearingX;
|
||||
INT8 vertBearingY;
|
||||
UINT8 vertAdvance;
|
||||
|
||||
DEFINE_SIZE_STATIC(8);
|
||||
};
|
||||
|
@ -73,18 +73,18 @@ struct SBitLineMetrics
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
CHAR ascender;
|
||||
CHAR decender;
|
||||
BYTE widthMax;
|
||||
CHAR caretSlopeNumerator;
|
||||
CHAR caretSlopeDenominator;
|
||||
CHAR caretOffset;
|
||||
CHAR minOriginSB;
|
||||
CHAR minAdvanceSB;
|
||||
CHAR maxBeforeBL;
|
||||
CHAR minAfterBL;
|
||||
CHAR padding1;
|
||||
CHAR padding2;
|
||||
INT8 ascender;
|
||||
INT8 decender;
|
||||
UINT8 widthMax;
|
||||
INT8 caretSlopeNumerator;
|
||||
INT8 caretSlopeDenominator;
|
||||
INT8 caretOffset;
|
||||
INT8 minOriginSB;
|
||||
INT8 minAdvanceSB;
|
||||
INT8 maxBeforeBL;
|
||||
INT8 minAfterBL;
|
||||
INT8 padding1;
|
||||
INT8 padding2;
|
||||
|
||||
DEFINE_SIZE_STATIC(12);
|
||||
};
|
||||
|
@ -102,9 +102,9 @@ struct IndexSubtableHeader
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
USHORT indexFormat;
|
||||
USHORT imageFormat;
|
||||
ULONG imageDataOffset;
|
||||
UINT16 indexFormat;
|
||||
UINT16 imageFormat;
|
||||
UINT32 imageDataOffset;
|
||||
|
||||
DEFINE_SIZE_STATIC(8);
|
||||
};
|
||||
|
@ -137,8 +137,8 @@ struct IndexSubtableFormat1Or3
|
|||
DEFINE_SIZE_ARRAY(8, offsetArrayZ);
|
||||
};
|
||||
|
||||
struct IndexSubtableFormat1 : IndexSubtableFormat1Or3<ULONG> {};
|
||||
struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<USHORT> {};
|
||||
struct IndexSubtableFormat1 : IndexSubtableFormat1Or3<UINT32> {};
|
||||
struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<UINT16> {};
|
||||
|
||||
struct IndexSubtable
|
||||
{
|
||||
|
@ -214,8 +214,8 @@ struct IndexSubtableRecord
|
|||
offset, length, format);
|
||||
}
|
||||
|
||||
USHORT firstGlyphIndex;
|
||||
USHORT lastGlyphIndex;
|
||||
UINT16 firstGlyphIndex;
|
||||
UINT16 lastGlyphIndex;
|
||||
LOffsetTo<IndexSubtable> offsetToSubtable;
|
||||
|
||||
DEFINE_SIZE_STATIC(8);
|
||||
|
@ -276,19 +276,19 @@ struct BitmapSizeTable
|
|||
|
||||
protected:
|
||||
LOffsetTo<IndexSubtableArray> indexSubtableArrayOffset;
|
||||
ULONG indexTablesSize;
|
||||
ULONG numberOfIndexSubtables;
|
||||
ULONG colorRef;
|
||||
UINT32 indexTablesSize;
|
||||
UINT32 numberOfIndexSubtables;
|
||||
UINT32 colorRef;
|
||||
SBitLineMetrics horizontal;
|
||||
SBitLineMetrics vertical;
|
||||
USHORT startGlyphIndex;
|
||||
USHORT endGlyphIndex;
|
||||
BYTE ppemX;
|
||||
BYTE ppemY;
|
||||
BYTE bitDepth;
|
||||
CHAR flags;
|
||||
UINT16 startGlyphIndex;
|
||||
UINT16 endGlyphIndex;
|
||||
UINT8 ppemX;
|
||||
UINT8 ppemY;
|
||||
UINT8 bitDepth;
|
||||
INT8 flags;
|
||||
|
||||
public:
|
||||
public:
|
||||
DEFINE_SIZE_STATIC(48);
|
||||
};
|
||||
|
||||
|
@ -300,8 +300,8 @@ public:
|
|||
struct GlyphBitmapDataFormat17
|
||||
{
|
||||
SmallGlyphMetrics glyphMetrics;
|
||||
ULONG dataLen;
|
||||
BYTE dataZ[VAR];
|
||||
UINT32 dataLen;
|
||||
UINT8 dataZ[VAR];
|
||||
|
||||
DEFINE_SIZE_ARRAY(9, dataZ);
|
||||
};
|
||||
|
@ -315,6 +315,8 @@ struct GlyphBitmapDataFormat17
|
|||
|
||||
struct CBLC
|
||||
{
|
||||
friend struct CBDT;
|
||||
|
||||
static const hb_tag_t tableTag = HB_OT_TAG_CBLC;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
|
@ -325,7 +327,7 @@ struct CBLC
|
|||
sizeTables.sanitize (c, this));
|
||||
}
|
||||
|
||||
public:
|
||||
protected:
|
||||
const IndexSubtableRecord *find_table (hb_codepoint_t glyph,
|
||||
unsigned int *x_ppem, unsigned int *y_ppem) const
|
||||
{
|
||||
|
@ -371,9 +373,94 @@ struct CBDT
|
|||
likely (version.major == 2 || version.major == 3));
|
||||
}
|
||||
|
||||
struct accelerator_t
|
||||
{
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
upem = face->get_upem();
|
||||
|
||||
cblc_blob = Sanitizer<CBLC>::sanitize (face->reference_table (HB_OT_TAG_CBLC));
|
||||
cbdt_blob = Sanitizer<CBDT>::sanitize (face->reference_table (HB_OT_TAG_CBDT));
|
||||
cbdt_len = hb_blob_get_length (cbdt_blob);
|
||||
|
||||
if (hb_blob_get_length (cblc_blob) == 0) {
|
||||
cblc = nullptr;
|
||||
cbdt = nullptr;
|
||||
return; /* Not a bitmap font. */
|
||||
}
|
||||
cblc = Sanitizer<CBLC>::lock_instance (cblc_blob);
|
||||
cbdt = Sanitizer<CBDT>::lock_instance (cbdt_blob);
|
||||
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (this->cblc_blob);
|
||||
hb_blob_destroy (this->cbdt_blob);
|
||||
}
|
||||
|
||||
inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
|
||||
{
|
||||
unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */
|
||||
|
||||
if (!cblc)
|
||||
return false; // Not a color bitmap font.
|
||||
|
||||
const IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem);
|
||||
if (!subtable_record || !x_ppem || !y_ppem)
|
||||
return false;
|
||||
|
||||
if (subtable_record->get_extents (extents))
|
||||
return true;
|
||||
|
||||
unsigned int image_offset = 0, image_length = 0, image_format = 0;
|
||||
if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format))
|
||||
return false;
|
||||
|
||||
{
|
||||
if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length))
|
||||
return false;
|
||||
|
||||
switch (image_format)
|
||||
{
|
||||
case 17: {
|
||||
if (unlikely (image_length < GlyphBitmapDataFormat17::min_size))
|
||||
return false;
|
||||
|
||||
const GlyphBitmapDataFormat17& glyphFormat17 =
|
||||
StructAtOffset<GlyphBitmapDataFormat17> (this->cbdt, image_offset);
|
||||
glyphFormat17.glyphMetrics.get_extents (extents);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TODO: Support other image formats.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert to the font units. */
|
||||
extents->x_bearing *= upem / (float) x_ppem;
|
||||
extents->y_bearing *= upem / (float) y_ppem;
|
||||
extents->width *= upem / (float) x_ppem;
|
||||
extents->height *= upem / (float) y_ppem;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
hb_blob_t *cblc_blob;
|
||||
hb_blob_t *cbdt_blob;
|
||||
const CBLC *cblc;
|
||||
const CBDT *cbdt;
|
||||
|
||||
unsigned int cbdt_len;
|
||||
unsigned int upem;
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
FixedVersion<>version;
|
||||
BYTE dataZ[VAR];
|
||||
UINT8 dataZ[VAR];
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY(4, dataZ);
|
||||
|
|
|
@ -58,10 +58,10 @@ struct CmapSubtableFormat0
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format number is set to 0. */
|
||||
USHORT lengthZ; /* Byte length of this subtable. */
|
||||
USHORT languageZ; /* Ignore. */
|
||||
BYTE glyphIdArray[256];/* An array that maps character
|
||||
UINT16 format; /* Format number is set to 0. */
|
||||
UINT16 lengthZ; /* Byte length of this subtable. */
|
||||
UINT16 languageZ; /* Ignore. */
|
||||
UINT8 glyphIdArray[256];/* An array that maps character
|
||||
* code to glyph index values. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6 + 256);
|
||||
|
@ -88,8 +88,8 @@ struct CmapSubtableFormat4
|
|||
|
||||
/* Custom two-array bsearch. */
|
||||
int min = 0, max = (int) thiz->segCount - 1;
|
||||
const USHORT *startCount = thiz->startCount;
|
||||
const USHORT *endCount = thiz->endCount;
|
||||
const UINT16 *startCount = thiz->startCount;
|
||||
const UINT16 *endCount = thiz->endCount;
|
||||
unsigned int i;
|
||||
while (min <= max)
|
||||
{
|
||||
|
@ -127,11 +127,11 @@ struct CmapSubtableFormat4
|
|||
return true;
|
||||
}
|
||||
|
||||
const USHORT *endCount;
|
||||
const USHORT *startCount;
|
||||
const USHORT *idDelta;
|
||||
const USHORT *idRangeOffset;
|
||||
const USHORT *glyphIdArray;
|
||||
const UINT16 *endCount;
|
||||
const UINT16 *startCount;
|
||||
const UINT16 *idDelta;
|
||||
const UINT16 *idRangeOffset;
|
||||
const UINT16 *glyphIdArray;
|
||||
unsigned int segCount;
|
||||
unsigned int glyphIdArrayLength;
|
||||
};
|
||||
|
@ -165,24 +165,24 @@ struct CmapSubtableFormat4
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format number is set to 4. */
|
||||
USHORT length; /* This is the length in bytes of the
|
||||
UINT16 format; /* Format number is set to 4. */
|
||||
UINT16 length; /* This is the length in bytes of the
|
||||
* subtable. */
|
||||
USHORT languageZ; /* Ignore. */
|
||||
USHORT segCountX2; /* 2 x segCount. */
|
||||
USHORT searchRangeZ; /* 2 * (2**floor(log2(segCount))) */
|
||||
USHORT entrySelectorZ; /* log2(searchRange/2) */
|
||||
USHORT rangeShiftZ; /* 2 x segCount - searchRange */
|
||||
UINT16 languageZ; /* Ignore. */
|
||||
UINT16 segCountX2; /* 2 x segCount. */
|
||||
UINT16 searchRangeZ; /* 2 * (2**floor(log2(segCount))) */
|
||||
UINT16 entrySelectorZ; /* log2(searchRange/2) */
|
||||
UINT16 rangeShiftZ; /* 2 x segCount - searchRange */
|
||||
|
||||
USHORT values[VAR];
|
||||
UINT16 values[VAR];
|
||||
#if 0
|
||||
USHORT endCount[segCount]; /* End characterCode for each segment,
|
||||
UINT16 endCount[segCount]; /* End characterCode for each segment,
|
||||
* last=0xFFFFu. */
|
||||
USHORT reservedPad; /* Set to 0. */
|
||||
USHORT startCount[segCount]; /* Start character code for each segment. */
|
||||
SHORT idDelta[segCount]; /* Delta for all character codes in segment. */
|
||||
USHORT idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */
|
||||
USHORT glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */
|
||||
UINT16 reservedPad; /* Set to 0. */
|
||||
UINT16 startCount[segCount]; /* Start character code for each segment. */
|
||||
INT16 idDelta[segCount]; /* Delta for all character codes in segment. */
|
||||
UINT16 idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */
|
||||
UINT16 glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
@ -208,9 +208,9 @@ struct CmapSubtableLongGroup
|
|||
}
|
||||
|
||||
private:
|
||||
ULONG startCharCode; /* First character code in this group. */
|
||||
ULONG endCharCode; /* Last character code in this group. */
|
||||
ULONG glyphID; /* Glyph index; interpretation depends on
|
||||
UINT32 startCharCode; /* First character code in this group. */
|
||||
UINT32 endCharCode; /* Last character code in this group. */
|
||||
UINT32 glyphID; /* Glyph index; interpretation depends on
|
||||
* subtable format. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (12);
|
||||
|
@ -247,8 +247,8 @@ struct CmapSubtableTrimmed
|
|||
DEFINE_SIZE_ARRAY (5 * sizeof (UINT), glyphIdArray);
|
||||
};
|
||||
|
||||
struct CmapSubtableFormat6 : CmapSubtableTrimmed<USHORT> {};
|
||||
struct CmapSubtableFormat10 : CmapSubtableTrimmed<ULONG > {};
|
||||
struct CmapSubtableFormat6 : CmapSubtableTrimmed<UINT16> {};
|
||||
struct CmapSubtableFormat10 : CmapSubtableTrimmed<UINT32 > {};
|
||||
|
||||
template <typename T>
|
||||
struct CmapSubtableLongSegmented
|
||||
|
@ -269,11 +269,11 @@ struct CmapSubtableLongSegmented
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Subtable format; set to 12. */
|
||||
USHORT reservedZ; /* Reserved; set to 0. */
|
||||
ULONG lengthZ; /* Byte length of this subtable. */
|
||||
ULONG languageZ; /* Ignore. */
|
||||
SortedArrayOf<CmapSubtableLongGroup, ULONG>
|
||||
UINT16 format; /* Subtable format; set to 12. */
|
||||
UINT16 reservedZ; /* Reserved; set to 0. */
|
||||
UINT32 lengthZ; /* Byte length of this subtable. */
|
||||
UINT32 languageZ; /* Ignore. */
|
||||
SortedArrayOf<CmapSubtableLongGroup, UINT32>
|
||||
groups; /* Groupings. */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (16, groups);
|
||||
|
@ -316,13 +316,13 @@ struct UnicodeValueRange
|
|||
}
|
||||
|
||||
UINT24 startUnicodeValue; /* First value in this range. */
|
||||
BYTE additionalCount; /* Number of additional values in this
|
||||
UINT8 additionalCount; /* Number of additional values in this
|
||||
* range. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
||||
typedef SortedArrayOf<UnicodeValueRange, ULONG> DefaultUVS;
|
||||
typedef SortedArrayOf<UnicodeValueRange, UINT32> DefaultUVS;
|
||||
|
||||
struct UVSMapping
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ struct UVSMapping
|
|||
DEFINE_SIZE_STATIC (5);
|
||||
};
|
||||
|
||||
typedef SortedArrayOf<UVSMapping, ULONG> NonDefaultUVS;
|
||||
typedef SortedArrayOf<UVSMapping, UINT32> NonDefaultUVS;
|
||||
|
||||
struct VariationSelectorRecord
|
||||
{
|
||||
|
@ -405,9 +405,9 @@ struct CmapSubtableFormat14
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format number is set to 14. */
|
||||
ULONG lengthZ; /* Byte length of this subtable. */
|
||||
SortedArrayOf<VariationSelectorRecord, ULONG>
|
||||
UINT16 format; /* Format number is set to 14. */
|
||||
UINT32 lengthZ; /* Byte length of this subtable. */
|
||||
SortedArrayOf<VariationSelectorRecord, UINT32>
|
||||
record; /* Variation selector records; sorted
|
||||
* in increasing order of `varSelector'. */
|
||||
public:
|
||||
|
@ -451,7 +451,7 @@ struct CmapSubtable
|
|||
|
||||
public:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
CmapSubtableFormat0 format0;
|
||||
CmapSubtableFormat4 format4;
|
||||
CmapSubtableFormat6 format6;
|
||||
|
@ -484,8 +484,8 @@ struct EncodingRecord
|
|||
subtable.sanitize (c, base));
|
||||
}
|
||||
|
||||
USHORT platformID; /* Platform ID. */
|
||||
USHORT encodingID; /* Platform-specific encoding ID. */
|
||||
UINT16 platformID; /* Platform ID. */
|
||||
UINT16 encodingID; /* Platform-specific encoding ID. */
|
||||
LOffsetTo<CmapSubtable>
|
||||
subtable; /* Byte offset from beginning of table to the subtable for this encoding. */
|
||||
public:
|
||||
|
@ -496,6 +496,146 @@ struct cmap
|
|||
{
|
||||
static const hb_tag_t tableTag = HB_OT_TAG_cmap;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (c->check_struct (this) &&
|
||||
likely (version == 0) &&
|
||||
encodingRecord.sanitize (c, this));
|
||||
}
|
||||
|
||||
struct accelerator_t
|
||||
{
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
|
||||
const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
|
||||
const OT::CmapSubtable *subtable = nullptr;
|
||||
const OT::CmapSubtableFormat14 *subtable_uvs = nullptr;
|
||||
|
||||
bool symbol = false;
|
||||
/* 32-bit subtables. */
|
||||
if (!subtable) subtable = cmap->find_subtable (3, 10);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 6);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 4);
|
||||
/* 16-bit subtables. */
|
||||
if (!subtable) subtable = cmap->find_subtable (3, 1);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 3);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 2);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 1);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 0);
|
||||
if (!subtable)
|
||||
{
|
||||
subtable = cmap->find_subtable (3, 0);
|
||||
if (subtable) symbol = true;
|
||||
}
|
||||
/* Meh. */
|
||||
if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
|
||||
|
||||
/* UVS subtable. */
|
||||
if (!subtable_uvs)
|
||||
{
|
||||
const OT::CmapSubtable *st = cmap->find_subtable (0, 5);
|
||||
if (st && st->u.format == 14)
|
||||
subtable_uvs = &st->u.format14;
|
||||
}
|
||||
/* Meh. */
|
||||
if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
|
||||
|
||||
this->uvs_table = subtable_uvs;
|
||||
|
||||
this->get_glyph_data = subtable;
|
||||
if (unlikely (symbol))
|
||||
this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>;
|
||||
else
|
||||
switch (subtable->u.format) {
|
||||
/* Accelerate format 4 and format 12. */
|
||||
default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>; break;
|
||||
case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break;
|
||||
case 4:
|
||||
{
|
||||
this->format4_accel.init (&subtable->u.format4);
|
||||
this->get_glyph_data = &this->format4_accel;
|
||||
this->get_glyph_func = this->format4_accel.get_glyph_func;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (this->blob);
|
||||
}
|
||||
|
||||
inline bool get_nominal_glyph (hb_codepoint_t unicode,
|
||||
hb_codepoint_t *glyph) const
|
||||
{
|
||||
return this->get_glyph_func (this->get_glyph_data, unicode, glyph);
|
||||
}
|
||||
|
||||
inline bool get_variation_glyph (hb_codepoint_t unicode,
|
||||
hb_codepoint_t variation_selector,
|
||||
hb_codepoint_t *glyph) const
|
||||
{
|
||||
switch (this->uvs_table->get_glyph_variant (unicode,
|
||||
variation_selector,
|
||||
glyph))
|
||||
{
|
||||
case OT::GLYPH_VARIANT_NOT_FOUND: return false;
|
||||
case OT::GLYPH_VARIANT_FOUND: return true;
|
||||
case OT::GLYPH_VARIANT_USE_DEFAULT: break;
|
||||
}
|
||||
|
||||
return get_nominal_glyph (unicode, glyph);
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
|
||||
hb_codepoint_t codepoint,
|
||||
hb_codepoint_t *glyph);
|
||||
|
||||
template <typename Type>
|
||||
static inline bool get_glyph_from (const void *obj,
|
||||
hb_codepoint_t codepoint,
|
||||
hb_codepoint_t *glyph)
|
||||
{
|
||||
const Type *typed_obj = (const Type *) obj;
|
||||
return typed_obj->get_glyph (codepoint, glyph);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
static inline bool get_glyph_from_symbol (const void *obj,
|
||||
hb_codepoint_t codepoint,
|
||||
hb_codepoint_t *glyph)
|
||||
{
|
||||
const Type *typed_obj = (const Type *) obj;
|
||||
if (likely (typed_obj->get_glyph (codepoint, glyph)))
|
||||
return true;
|
||||
|
||||
if (codepoint <= 0x00FFu)
|
||||
{
|
||||
/* For symbol-encoded OpenType fonts, we duplicate the
|
||||
* U+F000..F0FF range at U+0000..U+00FF. That's what
|
||||
* Windows seems to do, and that's hinted about at:
|
||||
* http://www.microsoft.com/typography/otspec/recom.htm
|
||||
* under "Non-Standard (Symbol) Fonts". */
|
||||
return typed_obj->get_glyph (0xF000u + codepoint, glyph);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
hb_cmap_get_glyph_func_t get_glyph_func;
|
||||
const void *get_glyph_data;
|
||||
OT::CmapSubtableFormat4::accelerator_t format4_accel;
|
||||
|
||||
const OT::CmapSubtableFormat14 *uvs_table;
|
||||
hb_blob_t *blob;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
inline const CmapSubtable *find_subtable (unsigned int platform_id,
|
||||
unsigned int encoding_id) const
|
||||
{
|
||||
|
@ -513,15 +653,8 @@ struct cmap
|
|||
return &(this+encodingRecord[result].subtable);
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
return_trace (c->check_struct (this) &&
|
||||
likely (version == 0) &&
|
||||
encodingRecord.sanitize (c, this));
|
||||
}
|
||||
|
||||
USHORT version; /* Table version number (0). */
|
||||
protected:
|
||||
UINT16 version; /* Table version number (0). */
|
||||
SortedArrayOf<EncodingRecord>
|
||||
encodingRecord; /* Encoding tables. */
|
||||
public:
|
||||
|
|
|
@ -33,466 +33,20 @@
|
|||
#include "hb-ot-cmap-table.hh"
|
||||
#include "hb-ot-cbdt-table.hh"
|
||||
#include "hb-ot-glyf-table.hh"
|
||||
#include "hb-ot-head-table.hh"
|
||||
#include "hb-ot-hhea-table.hh"
|
||||
#include "hb-ot-hmtx-table.hh"
|
||||
#include "hb-ot-kern-table.hh"
|
||||
#include "hb-ot-os2-table.hh"
|
||||
#include "hb-ot-post-table.hh"
|
||||
#include "hb-ot-var-hvar-table.hh"
|
||||
|
||||
|
||||
struct hb_ot_face_metrics_accelerator_t
|
||||
{
|
||||
unsigned int num_metrics;
|
||||
unsigned int num_advances;
|
||||
unsigned int default_advance;
|
||||
unsigned short ascender;
|
||||
unsigned short descender;
|
||||
unsigned short line_gap;
|
||||
bool has_font_extents;
|
||||
|
||||
const OT::hmtxvmtx *table;
|
||||
hb_blob_t *blob;
|
||||
|
||||
const OT::HVARVVAR *var;
|
||||
hb_blob_t *var_blob;
|
||||
|
||||
inline void init (hb_face_t *face,
|
||||
hb_tag_t _hea_tag,
|
||||
hb_tag_t _mtx_tag,
|
||||
hb_tag_t _var_tag,
|
||||
hb_tag_t os2_tag,
|
||||
unsigned int default_advance = 0)
|
||||
{
|
||||
this->default_advance = default_advance ? default_advance : face->get_upem ();
|
||||
|
||||
bool got_font_extents = false;
|
||||
if (os2_tag)
|
||||
{
|
||||
hb_blob_t *os2_blob = OT::Sanitizer<OT::os2>::sanitize (face->reference_table (os2_tag));
|
||||
const OT::os2 *os2 = OT::Sanitizer<OT::os2>::lock_instance (os2_blob);
|
||||
#define USE_TYPO_METRICS (1u<<7)
|
||||
if (0 != (os2->fsSelection & USE_TYPO_METRICS))
|
||||
{
|
||||
this->ascender = os2->sTypoAscender;
|
||||
this->descender = os2->sTypoDescender;
|
||||
this->line_gap = os2->sTypoLineGap;
|
||||
got_font_extents = (this->ascender | this->descender) != 0;
|
||||
}
|
||||
hb_blob_destroy (os2_blob);
|
||||
}
|
||||
|
||||
hb_blob_t *_hea_blob = OT::Sanitizer<OT::_hea>::sanitize (face->reference_table (_hea_tag));
|
||||
const OT::_hea *_hea = OT::Sanitizer<OT::_hea>::lock_instance (_hea_blob);
|
||||
this->num_advances = _hea->numberOfLongMetrics;
|
||||
if (!got_font_extents)
|
||||
{
|
||||
this->ascender = _hea->ascender;
|
||||
this->descender = _hea->descender;
|
||||
this->line_gap = _hea->lineGap;
|
||||
got_font_extents = (this->ascender | this->descender) != 0;
|
||||
}
|
||||
hb_blob_destroy (_hea_blob);
|
||||
|
||||
this->has_font_extents = got_font_extents;
|
||||
|
||||
this->blob = OT::Sanitizer<OT::hmtxvmtx>::sanitize (face->reference_table (_mtx_tag));
|
||||
|
||||
/* Cap num_metrics() and num_advances() based on table length. */
|
||||
unsigned int len = hb_blob_get_length (this->blob);
|
||||
if (unlikely (this->num_advances * 4 > len))
|
||||
this->num_advances = len / 4;
|
||||
this->num_metrics = this->num_advances + (len - 4 * this->num_advances) / 2;
|
||||
|
||||
/* We MUST set num_metrics to zero if num_advances is zero.
|
||||
* Our get_advance() depends on that. */
|
||||
if (unlikely (!this->num_advances))
|
||||
{
|
||||
this->num_metrics = this->num_advances = 0;
|
||||
hb_blob_destroy (this->blob);
|
||||
this->blob = hb_blob_get_empty ();
|
||||
}
|
||||
this->table = OT::Sanitizer<OT::hmtxvmtx>::lock_instance (this->blob);
|
||||
|
||||
this->var_blob = OT::Sanitizer<OT::HVARVVAR>::sanitize (face->reference_table (_var_tag));
|
||||
this->var = OT::Sanitizer<OT::HVARVVAR>::lock_instance (this->var_blob);
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (this->blob);
|
||||
hb_blob_destroy (this->var_blob);
|
||||
}
|
||||
|
||||
inline unsigned int get_advance (hb_codepoint_t glyph,
|
||||
hb_font_t *font) const
|
||||
{
|
||||
if (unlikely (glyph >= this->num_metrics))
|
||||
{
|
||||
/* If this->num_metrics is zero, it means we don't have the metrics table
|
||||
* for this direction: return default advance. Otherwise, it means that the
|
||||
* glyph index is out of bound: return zero. */
|
||||
if (this->num_metrics)
|
||||
return 0;
|
||||
else
|
||||
return this->default_advance;
|
||||
}
|
||||
|
||||
return this->table->longMetric[MIN (glyph, (uint32_t) this->num_advances - 1)].advance
|
||||
+ this->var->get_advance_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
|
||||
}
|
||||
};
|
||||
|
||||
struct hb_ot_face_glyf_accelerator_t
|
||||
{
|
||||
bool short_offset;
|
||||
unsigned int num_glyphs;
|
||||
const OT::loca *loca;
|
||||
const OT::glyf *glyf;
|
||||
hb_blob_t *loca_blob;
|
||||
hb_blob_t *glyf_blob;
|
||||
unsigned int glyf_len;
|
||||
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
hb_blob_t *head_blob = OT::Sanitizer<OT::head>::sanitize (face->reference_table (HB_OT_TAG_head));
|
||||
const OT::head *head = OT::Sanitizer<OT::head>::lock_instance (head_blob);
|
||||
if ((unsigned int) head->indexToLocFormat > 1 || head->glyphDataFormat != 0)
|
||||
{
|
||||
/* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */
|
||||
hb_blob_destroy (head_blob);
|
||||
return;
|
||||
}
|
||||
this->short_offset = 0 == head->indexToLocFormat;
|
||||
hb_blob_destroy (head_blob);
|
||||
|
||||
this->loca_blob = OT::Sanitizer<OT::loca>::sanitize (face->reference_table (HB_OT_TAG_loca));
|
||||
this->loca = OT::Sanitizer<OT::loca>::lock_instance (this->loca_blob);
|
||||
this->glyf_blob = OT::Sanitizer<OT::glyf>::sanitize (face->reference_table (HB_OT_TAG_glyf));
|
||||
this->glyf = OT::Sanitizer<OT::glyf>::lock_instance (this->glyf_blob);
|
||||
|
||||
this->num_glyphs = MAX (1u, hb_blob_get_length (this->loca_blob) / (this->short_offset ? 2 : 4)) - 1;
|
||||
this->glyf_len = hb_blob_get_length (this->glyf_blob);
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (this->loca_blob);
|
||||
hb_blob_destroy (this->glyf_blob);
|
||||
}
|
||||
|
||||
inline bool get_extents (hb_codepoint_t glyph,
|
||||
hb_glyph_extents_t *extents) const
|
||||
{
|
||||
if (unlikely (glyph >= this->num_glyphs))
|
||||
return false;
|
||||
|
||||
unsigned int start_offset, end_offset;
|
||||
if (this->short_offset)
|
||||
{
|
||||
start_offset = 2 * this->loca->u.shortsZ[glyph];
|
||||
end_offset = 2 * this->loca->u.shortsZ[glyph + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
start_offset = this->loca->u.longsZ[glyph];
|
||||
end_offset = this->loca->u.longsZ[glyph + 1];
|
||||
}
|
||||
|
||||
if (start_offset > end_offset || end_offset > this->glyf_len)
|
||||
return false;
|
||||
|
||||
if (end_offset - start_offset < OT::glyfGlyphHeader::static_size)
|
||||
return true; /* Empty glyph; zero extents. */
|
||||
|
||||
const OT::glyfGlyphHeader &glyph_header = OT::StructAtOffset<OT::glyfGlyphHeader> (this->glyf, start_offset);
|
||||
|
||||
extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax);
|
||||
extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax);
|
||||
extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing;
|
||||
extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct hb_ot_face_cbdt_accelerator_t
|
||||
{
|
||||
hb_blob_t *cblc_blob;
|
||||
hb_blob_t *cbdt_blob;
|
||||
const OT::CBLC *cblc;
|
||||
const OT::CBDT *cbdt;
|
||||
|
||||
unsigned int cbdt_len;
|
||||
unsigned int upem;
|
||||
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
upem = face->get_upem();
|
||||
|
||||
cblc_blob = OT::Sanitizer<OT::CBLC>::sanitize (face->reference_table (HB_OT_TAG_CBLC));
|
||||
cbdt_blob = OT::Sanitizer<OT::CBDT>::sanitize (face->reference_table (HB_OT_TAG_CBDT));
|
||||
cbdt_len = hb_blob_get_length (cbdt_blob);
|
||||
|
||||
if (hb_blob_get_length (cblc_blob) == 0) {
|
||||
cblc = nullptr;
|
||||
cbdt = nullptr;
|
||||
return; /* Not a bitmap font. */
|
||||
}
|
||||
cblc = OT::Sanitizer<OT::CBLC>::lock_instance (cblc_blob);
|
||||
cbdt = OT::Sanitizer<OT::CBDT>::lock_instance (cbdt_blob);
|
||||
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (this->cblc_blob);
|
||||
hb_blob_destroy (this->cbdt_blob);
|
||||
}
|
||||
|
||||
inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
|
||||
{
|
||||
unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */
|
||||
|
||||
if (!cblc)
|
||||
return false; // Not a color bitmap font.
|
||||
|
||||
const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem);
|
||||
if (!subtable_record || !x_ppem || !y_ppem)
|
||||
return false;
|
||||
|
||||
if (subtable_record->get_extents (extents))
|
||||
return true;
|
||||
|
||||
unsigned int image_offset = 0, image_length = 0, image_format = 0;
|
||||
if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format))
|
||||
return false;
|
||||
|
||||
{
|
||||
/* TODO Move the following into CBDT struct when adding more formats. */
|
||||
|
||||
if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length))
|
||||
return false;
|
||||
|
||||
switch (image_format)
|
||||
{
|
||||
case 17: {
|
||||
if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size))
|
||||
return false;
|
||||
|
||||
const OT::GlyphBitmapDataFormat17& glyphFormat17 =
|
||||
OT::StructAtOffset<OT::GlyphBitmapDataFormat17> (this->cbdt, image_offset);
|
||||
glyphFormat17.glyphMetrics.get_extents (extents);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TODO: Support other image formats.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert to the font units. */
|
||||
extents->x_bearing *= upem / (float) x_ppem;
|
||||
extents->y_bearing *= upem / (float) y_ppem;
|
||||
extents->width *= upem / (float) x_ppem;
|
||||
extents->height *= upem / (float) y_ppem;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct hb_ot_face_post_accelerator_t
|
||||
{
|
||||
hb_blob_t *post_blob;
|
||||
OT::post::accelerator_t accel;
|
||||
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
hb_blob_t *blob = this->post_blob = OT::Sanitizer<OT::post>::sanitize (face->reference_table (HB_OT_TAG_post));
|
||||
accel.init (OT::Sanitizer<OT::post>::lock_instance (blob), hb_blob_get_length (blob));
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
accel.fini ();
|
||||
hb_blob_destroy (this->post_blob);
|
||||
}
|
||||
|
||||
inline bool get_glyph_name (hb_codepoint_t glyph,
|
||||
char *name, unsigned int size) const
|
||||
{
|
||||
return this->accel.get_glyph_name (glyph, name, size);
|
||||
}
|
||||
|
||||
inline bool get_glyph_from_name (const char *name, int len,
|
||||
hb_codepoint_t *glyph) const
|
||||
{
|
||||
if (unlikely (!len))
|
||||
return false;
|
||||
|
||||
return this->accel.get_glyph_from_name (name, len, glyph);
|
||||
}
|
||||
};
|
||||
|
||||
struct hb_ot_face_kern_accelerator_t
|
||||
{
|
||||
hb_blob_t *kern_blob;
|
||||
OT::kern::accelerator_t accel;
|
||||
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
hb_blob_t *blob = this->kern_blob = OT::Sanitizer<OT::kern>::sanitize (face->reference_table (HB_OT_TAG_kern));
|
||||
accel.init (OT::Sanitizer<OT::kern>::lock_instance (blob), hb_blob_get_length (blob));
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
accel.fini ();
|
||||
hb_blob_destroy (this->kern_blob);
|
||||
}
|
||||
|
||||
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
||||
{ return accel.get_h_kerning (left, right); }
|
||||
};
|
||||
|
||||
typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
|
||||
hb_codepoint_t codepoint,
|
||||
hb_codepoint_t *glyph);
|
||||
|
||||
template <typename Type>
|
||||
static inline bool get_glyph_from (const void *obj,
|
||||
hb_codepoint_t codepoint,
|
||||
hb_codepoint_t *glyph)
|
||||
{
|
||||
const Type *typed_obj = (const Type *) obj;
|
||||
return typed_obj->get_glyph (codepoint, glyph);
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
static inline bool get_glyph_from_symbol (const void *obj,
|
||||
hb_codepoint_t codepoint,
|
||||
hb_codepoint_t *glyph)
|
||||
{
|
||||
const Type *typed_obj = (const Type *) obj;
|
||||
if (likely (typed_obj->get_glyph (codepoint, glyph)))
|
||||
return true;
|
||||
|
||||
if (codepoint <= 0x00FFu)
|
||||
{
|
||||
/* For symbol-encoded OpenType fonts, we duplicate the
|
||||
* U+F000..F0FF range at U+0000..U+00FF. That's what
|
||||
* Windows seems to do, and that's hinted about at:
|
||||
* http://www.microsoft.com/typography/otspec/recom.htm
|
||||
* under "Non-Standard (Symbol) Fonts". */
|
||||
return typed_obj->get_glyph (0xF000u + codepoint, glyph);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
struct hb_ot_face_cmap_accelerator_t
|
||||
{
|
||||
hb_cmap_get_glyph_func_t get_glyph_func;
|
||||
const void *get_glyph_data;
|
||||
OT::CmapSubtableFormat4::accelerator_t format4_accel;
|
||||
|
||||
const OT::CmapSubtableFormat14 *uvs_table;
|
||||
hb_blob_t *blob;
|
||||
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
|
||||
const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
|
||||
const OT::CmapSubtable *subtable = nullptr;
|
||||
const OT::CmapSubtableFormat14 *subtable_uvs = nullptr;
|
||||
|
||||
bool symbol = false;
|
||||
/* 32-bit subtables. */
|
||||
if (!subtable) subtable = cmap->find_subtable (3, 10);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 6);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 4);
|
||||
/* 16-bit subtables. */
|
||||
if (!subtable) subtable = cmap->find_subtable (3, 1);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 3);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 2);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 1);
|
||||
if (!subtable) subtable = cmap->find_subtable (0, 0);
|
||||
if (!subtable)
|
||||
{
|
||||
subtable = cmap->find_subtable (3, 0);
|
||||
if (subtable) symbol = true;
|
||||
}
|
||||
/* Meh. */
|
||||
if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
|
||||
|
||||
/* UVS subtable. */
|
||||
if (!subtable_uvs)
|
||||
{
|
||||
const OT::CmapSubtable *st = cmap->find_subtable (0, 5);
|
||||
if (st && st->u.format == 14)
|
||||
subtable_uvs = &st->u.format14;
|
||||
}
|
||||
/* Meh. */
|
||||
if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
|
||||
|
||||
this->uvs_table = subtable_uvs;
|
||||
|
||||
this->get_glyph_data = subtable;
|
||||
if (unlikely (symbol))
|
||||
this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>;
|
||||
else
|
||||
switch (subtable->u.format) {
|
||||
/* Accelerate format 4 and format 12. */
|
||||
default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>; break;
|
||||
case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break;
|
||||
case 4:
|
||||
{
|
||||
this->format4_accel.init (&subtable->u.format4);
|
||||
this->get_glyph_data = &this->format4_accel;
|
||||
this->get_glyph_func = this->format4_accel.get_glyph_func;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (this->blob);
|
||||
}
|
||||
|
||||
inline bool get_nominal_glyph (hb_codepoint_t unicode,
|
||||
hb_codepoint_t *glyph) const
|
||||
{
|
||||
return this->get_glyph_func (this->get_glyph_data, unicode, glyph);
|
||||
}
|
||||
|
||||
inline bool get_variation_glyph (hb_codepoint_t unicode,
|
||||
hb_codepoint_t variation_selector,
|
||||
hb_codepoint_t *glyph) const
|
||||
{
|
||||
switch (this->uvs_table->get_glyph_variant (unicode,
|
||||
variation_selector,
|
||||
glyph))
|
||||
{
|
||||
case OT::GLYPH_VARIANT_NOT_FOUND: return false;
|
||||
case OT::GLYPH_VARIANT_FOUND: return true;
|
||||
case OT::GLYPH_VARIANT_USE_DEFAULT: break;
|
||||
}
|
||||
|
||||
return get_nominal_glyph (unicode, glyph);
|
||||
}
|
||||
};
|
||||
|
||||
struct hb_ot_font_t
|
||||
{
|
||||
hb_ot_face_cmap_accelerator_t cmap;
|
||||
hb_ot_face_metrics_accelerator_t h_metrics;
|
||||
hb_ot_face_metrics_accelerator_t v_metrics;
|
||||
OT::hb_lazy_loader_t<hb_ot_face_glyf_accelerator_t> glyf;
|
||||
OT::hb_lazy_loader_t<hb_ot_face_cbdt_accelerator_t> cbdt;
|
||||
OT::hb_lazy_loader_t<hb_ot_face_post_accelerator_t> post;
|
||||
OT::hb_lazy_loader_t<hb_ot_face_kern_accelerator_t> kern;
|
||||
OT::cmap::accelerator_t cmap;
|
||||
OT::hmtx::accelerator_t h_metrics;
|
||||
OT::vmtx::accelerator_t v_metrics;
|
||||
OT::hb_lazy_loader_t<OT::glyf::accelerator_t> glyf;
|
||||
OT::hb_lazy_loader_t<OT::CBDT::accelerator_t> cbdt;
|
||||
OT::hb_lazy_loader_t<OT::post::accelerator_t> post;
|
||||
OT::hb_lazy_loader_t<OT::kern::accelerator_t> kern;
|
||||
};
|
||||
|
||||
|
||||
|
@ -505,9 +59,8 @@ _hb_ot_font_create (hb_face_t *face)
|
|||
return nullptr;
|
||||
|
||||
ot_font->cmap.init (face);
|
||||
ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_HVAR, HB_OT_TAG_os2);
|
||||
ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_OT_TAG_VVAR, HB_TAG_NONE,
|
||||
ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */
|
||||
ot_font->h_metrics.init (face);
|
||||
ot_font->v_metrics.init (face, ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */
|
||||
ot_font->glyf.init (face);
|
||||
ot_font->cbdt.init (face);
|
||||
ot_font->post.init (face);
|
||||
|
@ -688,7 +241,7 @@ retry:
|
|||
hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, nullptr, nullptr);
|
||||
//hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, nullptr, nullptr);
|
||||
hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr);
|
||||
//hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr); TODO
|
||||
//hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr);
|
||||
hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, nullptr, nullptr);
|
||||
hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, nullptr, nullptr);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define HB_OT_GLYF_TABLE_HH
|
||||
|
||||
#include "hb-open-type-private.hh"
|
||||
#include "hb-ot-head-table.hh"
|
||||
|
||||
|
||||
namespace OT {
|
||||
|
@ -42,6 +43,8 @@ namespace OT {
|
|||
|
||||
struct loca
|
||||
{
|
||||
friend struct glyf;
|
||||
|
||||
static const hb_tag_t tableTag = HB_OT_TAG_loca;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
|
@ -50,12 +53,9 @@ struct loca
|
|||
return_trace (true);
|
||||
}
|
||||
|
||||
public:
|
||||
union {
|
||||
USHORT shortsZ[VAR]; /* Location offset divided by 2. */
|
||||
ULONG longsZ[VAR]; /* Location offset. */
|
||||
} u;
|
||||
DEFINE_SIZE_ARRAY (0, u.longsZ);
|
||||
protected:
|
||||
UINT8 dataX[VAR]; /* Location data. */
|
||||
DEFINE_SIZE_ARRAY (0, dataX);
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,15 +78,9 @@ struct glyf
|
|||
return_trace (true);
|
||||
}
|
||||
|
||||
public:
|
||||
BYTE dataX[VAR]; /* Glyphs data. */
|
||||
|
||||
DEFINE_SIZE_ARRAY (0, dataX);
|
||||
};
|
||||
|
||||
struct glyfGlyphHeader
|
||||
{
|
||||
SHORT numberOfContours; /* If the number of contours is
|
||||
struct GlyphHeader
|
||||
{
|
||||
INT16 numberOfContours; /* If the number of contours is
|
||||
* greater than or equal to zero,
|
||||
* this is a simple glyph; if negative,
|
||||
* this is a composite glyph. */
|
||||
|
@ -96,6 +90,88 @@ struct glyfGlyphHeader
|
|||
FWORD yMax; /* Maximum y for coordinate data. */
|
||||
|
||||
DEFINE_SIZE_STATIC (10);
|
||||
};
|
||||
|
||||
struct accelerator_t
|
||||
{
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
hb_blob_t *head_blob = Sanitizer<head>::sanitize (face->reference_table (HB_OT_TAG_head));
|
||||
const head *head_table = Sanitizer<head>::lock_instance (head_blob);
|
||||
if ((unsigned int) head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0)
|
||||
{
|
||||
/* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */
|
||||
hb_blob_destroy (head_blob);
|
||||
return;
|
||||
}
|
||||
short_offset = 0 == head_table->indexToLocFormat;
|
||||
hb_blob_destroy (head_blob);
|
||||
|
||||
loca_blob = Sanitizer<loca>::sanitize (face->reference_table (HB_OT_TAG_loca));
|
||||
loca_table = Sanitizer<loca>::lock_instance (loca_blob);
|
||||
glyf_blob = Sanitizer<glyf>::sanitize (face->reference_table (HB_OT_TAG_glyf));
|
||||
glyf_table = Sanitizer<glyf>::lock_instance (glyf_blob);
|
||||
|
||||
num_glyphs = MAX (1u, hb_blob_get_length (loca_blob) / (short_offset ? 2 : 4)) - 1;
|
||||
glyf_len = hb_blob_get_length (glyf_blob);
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (loca_blob);
|
||||
hb_blob_destroy (glyf_blob);
|
||||
}
|
||||
|
||||
inline bool get_extents (hb_codepoint_t glyph,
|
||||
hb_glyph_extents_t *extents) const
|
||||
{
|
||||
if (unlikely (glyph >= num_glyphs))
|
||||
return false;
|
||||
|
||||
unsigned int start_offset, end_offset;
|
||||
if (short_offset)
|
||||
{
|
||||
const UINT16 *offsets = (const UINT16 *) loca_table->dataX;
|
||||
start_offset = 2 * offsets[glyph];
|
||||
end_offset = 2 * offsets[glyph + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
const UINT32 *offsets = (const UINT32 *) loca_table->dataX;
|
||||
start_offset = offsets[glyph];
|
||||
end_offset = offsets[glyph + 1];
|
||||
}
|
||||
|
||||
if (start_offset > end_offset || end_offset > glyf_len)
|
||||
return false;
|
||||
|
||||
if (end_offset - start_offset < GlyphHeader::static_size)
|
||||
return true; /* Empty glyph; zero extents. */
|
||||
|
||||
const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyf_table, start_offset);
|
||||
|
||||
extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax);
|
||||
extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax);
|
||||
extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing;
|
||||
extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool short_offset;
|
||||
unsigned int num_glyphs;
|
||||
const loca *loca_table;
|
||||
const glyf *glyf_table;
|
||||
hb_blob_t *loca_blob;
|
||||
hb_blob_t *glyf_blob;
|
||||
unsigned int glyf_len;
|
||||
};
|
||||
|
||||
protected:
|
||||
UINT8 dataX[VAR]; /* Glyphs data. */
|
||||
|
||||
DEFINE_SIZE_ARRAY (0, dataX);
|
||||
};
|
||||
|
||||
} /* namespace OT */
|
||||
|
|
|
@ -64,11 +64,11 @@ struct head
|
|||
FixedVersion<>version; /* Version of the head table--currently
|
||||
* 0x00010000u for version 1.0. */
|
||||
FixedVersion<>fontRevision; /* Set by font manufacturer. */
|
||||
ULONG checkSumAdjustment; /* To compute: set it to 0, sum the
|
||||
* entire font as ULONG, then store
|
||||
UINT32 checkSumAdjustment; /* To compute: set it to 0, sum the
|
||||
* entire font as UINT32, then store
|
||||
* 0xB1B0AFBAu - sum. */
|
||||
ULONG magicNumber; /* Set to 0x5F0F3CF5u. */
|
||||
USHORT flags; /* Bit 0: Baseline for font at y=0;
|
||||
UINT32 magicNumber; /* Set to 0x5F0F3CF5u. */
|
||||
UINT16 flags; /* Bit 0: Baseline for font at y=0;
|
||||
* Bit 1: Left sidebearing point at x=0;
|
||||
* Bit 2: Instructions may depend on point size;
|
||||
* Bit 3: Force ppem to integer values for all
|
||||
|
@ -114,18 +114,18 @@ struct head
|
|||
* encoded in the cmap subtables represent proper
|
||||
* support for those code points.
|
||||
* Bit 15: Reserved, set to 0. */
|
||||
USHORT unitsPerEm; /* Valid range is from 16 to 16384. This value
|
||||
UINT16 unitsPerEm; /* Valid range is from 16 to 16384. This value
|
||||
* should be a power of 2 for fonts that have
|
||||
* TrueType outlines. */
|
||||
LONGDATETIME created; /* Number of seconds since 12:00 midnight,
|
||||
January 1, 1904. 64-bit integer */
|
||||
LONGDATETIME modified; /* Number of seconds since 12:00 midnight,
|
||||
January 1, 1904. 64-bit integer */
|
||||
SHORT xMin; /* For all glyph bounding boxes. */
|
||||
SHORT yMin; /* For all glyph bounding boxes. */
|
||||
SHORT xMax; /* For all glyph bounding boxes. */
|
||||
SHORT yMax; /* For all glyph bounding boxes. */
|
||||
USHORT macStyle; /* Bit 0: Bold (if set to 1);
|
||||
INT16 xMin; /* For all glyph bounding boxes. */
|
||||
INT16 yMin; /* For all glyph bounding boxes. */
|
||||
INT16 xMax; /* For all glyph bounding boxes. */
|
||||
INT16 yMax; /* For all glyph bounding boxes. */
|
||||
UINT16 macStyle; /* Bit 0: Bold (if set to 1);
|
||||
* Bit 1: Italic (if set to 1)
|
||||
* Bit 2: Underline (if set to 1)
|
||||
* Bit 3: Outline (if set to 1)
|
||||
|
@ -133,16 +133,16 @@ struct head
|
|||
* Bit 5: Condensed (if set to 1)
|
||||
* Bit 6: Extended (if set to 1)
|
||||
* Bits 7-15: Reserved (set to 0). */
|
||||
USHORT lowestRecPPEM; /* Smallest readable size in pixels. */
|
||||
SHORT fontDirectionHint; /* Deprecated (Set to 2).
|
||||
UINT16 lowestRecPPEM; /* Smallest readable size in pixels. */
|
||||
INT16 fontDirectionHint; /* Deprecated (Set to 2).
|
||||
* 0: Fully mixed directional glyphs;
|
||||
* 1: Only strongly left to right;
|
||||
* 2: Like 1 but also contains neutrals;
|
||||
* -1: Only strongly right to left;
|
||||
* -2: Like -1 but also contains neutrals. */
|
||||
public:
|
||||
SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */
|
||||
SHORT glyphDataFormat; /* 0 for current format. */
|
||||
INT16 indexToLocFormat; /* 0 for short offsets, 1 for long. */
|
||||
INT16 glyphDataFormat; /* 0 for current format. */
|
||||
|
||||
DEFINE_SIZE_STATIC (54);
|
||||
};
|
||||
|
|
|
@ -44,11 +44,6 @@ namespace OT {
|
|||
|
||||
struct _hea
|
||||
{
|
||||
static const hb_tag_t tableTag = HB_TAG('_','h','e','a');
|
||||
|
||||
static const hb_tag_t hheaTag = HB_OT_TAG_hhea;
|
||||
static const hb_tag_t vheaTag = HB_OT_TAG_vhea;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
@ -69,21 +64,21 @@ struct _hea
|
|||
* (xMax - xMin)) for horizontal. */
|
||||
FWORD maxExtent; /* horizontal: Max(lsb + (xMax - xMin)),
|
||||
* vertical: minLeadingBearing+(yMax-yMin). */
|
||||
SHORT caretSlopeRise; /* Used to calculate the slope of the
|
||||
INT16 caretSlopeRise; /* Used to calculate the slope of the
|
||||
* cursor (rise/run); 1 for vertical caret,
|
||||
* 0 for horizontal.*/
|
||||
SHORT caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */
|
||||
SHORT caretOffset; /* The amount by which a slanted
|
||||
INT16 caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */
|
||||
INT16 caretOffset; /* The amount by which a slanted
|
||||
* highlight on a glyph needs
|
||||
* to be shifted to produce the
|
||||
* best appearance. Set to 0 for
|
||||
* non-slanted fonts. */
|
||||
SHORT reserved1; /* Set to 0. */
|
||||
SHORT reserved2; /* Set to 0. */
|
||||
SHORT reserved3; /* Set to 0. */
|
||||
SHORT reserved4; /* Set to 0. */
|
||||
SHORT metricDataFormat; /* 0 for current format. */
|
||||
USHORT numberOfLongMetrics; /* Number of LongMetric entries in metric
|
||||
INT16 reserved1; /* Set to 0. */
|
||||
INT16 reserved2; /* Set to 0. */
|
||||
INT16 reserved3; /* Set to 0. */
|
||||
INT16 reserved4; /* Set to 0. */
|
||||
INT16 metricDataFormat; /* 0 for current format. */
|
||||
UINT16 numberOfLongMetrics; /* Number of LongMetric entries in metric
|
||||
* table. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (36);
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
#define HB_OT_HMTX_TABLE_HH
|
||||
|
||||
#include "hb-open-type-private.hh"
|
||||
#include "hb-ot-hhea-table.hh"
|
||||
#include "hb-ot-os2-table.hh"
|
||||
#include "hb-ot-var-hvar-table.hh"
|
||||
|
||||
|
||||
namespace OT {
|
||||
|
@ -50,11 +53,9 @@ struct LongMetric
|
|||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct hmtxvmtx
|
||||
{
|
||||
static const hb_tag_t hmtxTag = HB_OT_TAG_hmtx;
|
||||
static const hb_tag_t vmtxTag = HB_OT_TAG_vmtx;
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
@ -63,7 +64,107 @@ struct hmtxvmtx
|
|||
return_trace (true);
|
||||
}
|
||||
|
||||
struct accelerator_t
|
||||
{
|
||||
inline void init (hb_face_t *face,
|
||||
unsigned int default_advance_ = 0)
|
||||
{
|
||||
default_advance = default_advance_ ? default_advance_ : face->get_upem ();
|
||||
|
||||
bool got_font_extents = false;
|
||||
if (T::os2Tag)
|
||||
{
|
||||
hb_blob_t *os2_blob = Sanitizer<os2>::sanitize (face->reference_table (T::os2Tag));
|
||||
const os2 *os2_table = Sanitizer<os2>::lock_instance (os2_blob);
|
||||
#define USE_TYPO_METRICS (1u<<7)
|
||||
if (0 != (os2_table->fsSelection & USE_TYPO_METRICS))
|
||||
{
|
||||
ascender = os2_table->sTypoAscender;
|
||||
descender = os2_table->sTypoDescender;
|
||||
line_gap = os2_table->sTypoLineGap;
|
||||
got_font_extents = (ascender | descender) != 0;
|
||||
}
|
||||
hb_blob_destroy (os2_blob);
|
||||
}
|
||||
|
||||
hb_blob_t *_hea_blob = Sanitizer<_hea>::sanitize (face->reference_table (T::headerTag));
|
||||
const _hea *_hea_table = Sanitizer<_hea>::lock_instance (_hea_blob);
|
||||
num_advances = _hea_table->numberOfLongMetrics;
|
||||
if (!got_font_extents)
|
||||
{
|
||||
ascender = _hea_table->ascender;
|
||||
descender = _hea_table->descender;
|
||||
line_gap = _hea_table->lineGap;
|
||||
got_font_extents = (ascender | descender) != 0;
|
||||
}
|
||||
hb_blob_destroy (_hea_blob);
|
||||
|
||||
has_font_extents = got_font_extents;
|
||||
|
||||
blob = Sanitizer<hmtxvmtx>::sanitize (face->reference_table (T::tableTag));
|
||||
|
||||
/* Cap num_metrics() and num_advances() based on table length. */
|
||||
unsigned int len = hb_blob_get_length (blob);
|
||||
if (unlikely (num_advances * 4 > len))
|
||||
num_advances = len / 4;
|
||||
num_metrics = num_advances + (len - 4 * num_advances) / 2;
|
||||
|
||||
/* We MUST set num_metrics to zero if num_advances is zero.
|
||||
* Our get_advance() depends on that. */
|
||||
if (unlikely (!num_advances))
|
||||
{
|
||||
num_metrics = num_advances = 0;
|
||||
hb_blob_destroy (blob);
|
||||
blob = hb_blob_get_empty ();
|
||||
}
|
||||
table = Sanitizer<hmtxvmtx>::lock_instance (blob);
|
||||
|
||||
var_blob = Sanitizer<HVARVVAR>::sanitize (face->reference_table (T::variationsTag));
|
||||
var_table = Sanitizer<HVARVVAR>::lock_instance (var_blob);
|
||||
}
|
||||
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (blob);
|
||||
hb_blob_destroy (var_blob);
|
||||
}
|
||||
|
||||
inline unsigned int get_advance (hb_codepoint_t glyph,
|
||||
hb_font_t *font) const
|
||||
{
|
||||
if (unlikely (glyph >= num_metrics))
|
||||
{
|
||||
/* If num_metrics is zero, it means we don't have the metrics table
|
||||
* for this direction: return default advance. Otherwise, it means that the
|
||||
* glyph index is out of bound: return zero. */
|
||||
if (num_metrics)
|
||||
return 0;
|
||||
else
|
||||
return default_advance;
|
||||
}
|
||||
|
||||
return table->longMetric[MIN (glyph, (uint32_t) num_advances - 1)].advance
|
||||
+ var_table->get_advance_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
|
||||
}
|
||||
|
||||
public:
|
||||
bool has_font_extents;
|
||||
unsigned short ascender;
|
||||
unsigned short descender;
|
||||
unsigned short line_gap;
|
||||
|
||||
private:
|
||||
unsigned int num_metrics;
|
||||
unsigned int num_advances;
|
||||
unsigned int default_advance;
|
||||
|
||||
const hmtxvmtx *table;
|
||||
hb_blob_t *blob;
|
||||
const HVARVVAR *var_table;
|
||||
hb_blob_t *var_blob;
|
||||
};
|
||||
|
||||
protected:
|
||||
LongMetric longMetric[VAR]; /* Paired advance width and leading
|
||||
* bearing values for each glyph. The
|
||||
* value numOfHMetrics comes from
|
||||
|
@ -89,11 +190,17 @@ struct hmtxvmtx
|
|||
DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX);
|
||||
};
|
||||
|
||||
struct hmtx : hmtxvmtx {
|
||||
struct hmtx : hmtxvmtx<hmtx> {
|
||||
static const hb_tag_t tableTag = HB_OT_TAG_hmtx;
|
||||
static const hb_tag_t headerTag = HB_OT_TAG_hhea;
|
||||
static const hb_tag_t variationsTag = HB_OT_TAG_HVAR;
|
||||
static const hb_tag_t os2Tag = HB_OT_TAG_os2;
|
||||
};
|
||||
struct vmtx : hmtxvmtx {
|
||||
struct vmtx : hmtxvmtx<vmtx> {
|
||||
static const hb_tag_t tableTag = HB_OT_TAG_vmtx;
|
||||
static const hb_tag_t headerTag = HB_OT_TAG_vhea;
|
||||
static const hb_tag_t variationsTag = HB_OT_TAG_VVAR;
|
||||
static const hb_tag_t os2Tag = HB_TAG_NONE;
|
||||
};
|
||||
|
||||
} /* namespace OT */
|
||||
|
|
|
@ -104,8 +104,8 @@ struct KernClassTable
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT firstGlyph; /* First glyph in class range. */
|
||||
ArrayOf<USHORT> classes; /* Glyph classes. */
|
||||
UINT16 firstGlyph; /* First glyph in class range. */
|
||||
ArrayOf<UINT16> classes; /* Glyph classes. */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (4, classes);
|
||||
};
|
||||
|
@ -136,7 +136,7 @@ struct KernSubTableFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT rowWidth; /* The width, in bytes, of a row in the table. */
|
||||
UINT16 rowWidth; /* The width, in bytes, of a row in the table. */
|
||||
OffsetTo<KernClassTable>
|
||||
leftClassTable; /* Offset from beginning of this subtable to
|
||||
* left-hand class table. */
|
||||
|
@ -275,19 +275,19 @@ struct KernOT : KernTable<KernOT>
|
|||
};
|
||||
|
||||
protected:
|
||||
USHORT versionZ; /* Unused. */
|
||||
USHORT length; /* Length of the subtable (including this header). */
|
||||
BYTE format; /* Subtable format. */
|
||||
BYTE coverage; /* Coverage bits. */
|
||||
UINT16 versionZ; /* Unused. */
|
||||
UINT16 length; /* Length of the subtable (including this header). */
|
||||
UINT8 format; /* Subtable format. */
|
||||
UINT8 coverage; /* Coverage bits. */
|
||||
KernSubTable subtable; /* Subtable data. */
|
||||
public:
|
||||
DEFINE_SIZE_MIN (6);
|
||||
};
|
||||
|
||||
protected:
|
||||
USHORT version; /* Version--0x0000u */
|
||||
USHORT nTables; /* Number of subtables in the kerning table. */
|
||||
BYTE data[VAR];
|
||||
UINT16 version; /* Version--0x0000u */
|
||||
UINT16 nTables; /* Number of subtables in the kerning table. */
|
||||
UINT8 data[VAR];
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (4, data);
|
||||
};
|
||||
|
@ -314,10 +314,10 @@ struct KernAAT : KernTable<KernAAT>
|
|||
};
|
||||
|
||||
protected:
|
||||
ULONG length; /* Length of the subtable (including this header). */
|
||||
BYTE coverage; /* Coverage bits. */
|
||||
BYTE format; /* Subtable format. */
|
||||
USHORT tupleIndex; /* The tuple index (used for variations fonts).
|
||||
UINT32 length; /* Length of the subtable (including this header). */
|
||||
UINT8 coverage; /* Coverage bits. */
|
||||
UINT8 format; /* Subtable format. */
|
||||
UINT16 tupleIndex; /* The tuple index (used for variations fonts).
|
||||
* This value specifies which tuple this subtable covers. */
|
||||
KernSubTable subtable; /* Subtable data. */
|
||||
public:
|
||||
|
@ -325,9 +325,9 @@ struct KernAAT : KernTable<KernAAT>
|
|||
};
|
||||
|
||||
protected:
|
||||
ULONG version; /* Version--0x00010000u */
|
||||
ULONG nTables; /* Number of subtables in the kerning table. */
|
||||
BYTE data[VAR];
|
||||
UINT32 version; /* Version--0x00010000u */
|
||||
UINT32 nTables; /* Number of subtables in the kerning table. */
|
||||
UINT8 data[VAR];
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (8, data);
|
||||
};
|
||||
|
@ -358,24 +358,29 @@ struct kern
|
|||
|
||||
struct accelerator_t
|
||||
{
|
||||
inline void init (const kern *table_, unsigned int table_length_)
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
table = table_;
|
||||
table_length = table_length_;
|
||||
blob = Sanitizer<kern>::sanitize (face->reference_table (HB_OT_TAG_kern));
|
||||
table = Sanitizer<kern>::lock_instance (blob);
|
||||
table_length = hb_blob_get_length (blob);
|
||||
}
|
||||
inline void fini (void)
|
||||
{
|
||||
hb_blob_destroy (blob);
|
||||
}
|
||||
inline void fini (void) {}
|
||||
|
||||
inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
|
||||
{ return table->get_h_kerning (left, right, table_length); }
|
||||
|
||||
private:
|
||||
hb_blob_t *blob;
|
||||
const kern *table;
|
||||
unsigned int table_length;
|
||||
};
|
||||
|
||||
protected:
|
||||
union {
|
||||
USHORT major;
|
||||
UINT16 major;
|
||||
KernOT ot;
|
||||
KernAAT aat;
|
||||
} u;
|
||||
|
|
|
@ -161,7 +161,7 @@ struct RangeRecord
|
|||
|
||||
GlyphID start; /* First GlyphID in the range */
|
||||
GlyphID end; /* Last GlyphID in the range */
|
||||
USHORT value; /* Value */
|
||||
UINT16 value; /* Value */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
|
@ -175,7 +175,7 @@ struct IndexArray : ArrayOf<Index>
|
|||
unsigned int *_indexes /* OUT */) const
|
||||
{
|
||||
if (_count) {
|
||||
const USHORT *arr = this->sub_array (start_offset, _count);
|
||||
const UINT16 *arr = this->sub_array (start_offset, _count);
|
||||
unsigned int count = *_count;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
_indexes[i] = arr[i];
|
||||
|
@ -216,9 +216,9 @@ struct LangSys
|
|||
return_trace (c->check_struct (this) && featureIndex.sanitize (c));
|
||||
}
|
||||
|
||||
Offset<> lookupOrderZ; /* = Null (reserved for an offset to a
|
||||
Offset16 lookupOrderZ; /* = Null (reserved for an offset to a
|
||||
* reordering table) */
|
||||
USHORT reqFeatureIndex;/* Index of a feature required for this
|
||||
UINT16 reqFeatureIndex;/* Index of a feature required for this
|
||||
* language system--if no required features
|
||||
* = 0xFFFFu */
|
||||
IndexArray featureIndex; /* Array of indices into the FeatureList */
|
||||
|
@ -343,12 +343,12 @@ struct FeatureParamsSize
|
|||
return_trace (true);
|
||||
}
|
||||
|
||||
USHORT designSize; /* Represents the design size in 720/inch
|
||||
UINT16 designSize; /* Represents the design size in 720/inch
|
||||
* units (decipoints). The design size entry
|
||||
* must be non-zero. When there is a design
|
||||
* size but no recommended size range, the
|
||||
* rest of the array will consist of zeros. */
|
||||
USHORT subfamilyID; /* Has no independent meaning, but serves
|
||||
UINT16 subfamilyID; /* Has no independent meaning, but serves
|
||||
* as an identifier that associates fonts
|
||||
* in a subfamily. All fonts which share a
|
||||
* Preferred or Font Family name and which
|
||||
|
@ -358,7 +358,7 @@ struct FeatureParamsSize
|
|||
* same subfamily value. If this value is
|
||||
* zero, the remaining fields in the array
|
||||
* will be ignored. */
|
||||
USHORT subfamilyNameID;/* If the preceding value is non-zero, this
|
||||
UINT16 subfamilyNameID;/* If the preceding value is non-zero, this
|
||||
* value must be set in the range 256 - 32767
|
||||
* (inclusive). It records the value of a
|
||||
* field in the name table, which must
|
||||
|
@ -372,10 +372,10 @@ struct FeatureParamsSize
|
|||
* subfamily in a menu. Applications will
|
||||
* choose the appropriate version based on
|
||||
* their selection criteria. */
|
||||
USHORT rangeStart; /* Large end of the recommended usage range
|
||||
UINT16 rangeStart; /* Large end of the recommended usage range
|
||||
* (inclusive), stored in 720/inch units
|
||||
* (decipoints). */
|
||||
USHORT rangeEnd; /* Small end of the recommended usage range
|
||||
UINT16 rangeEnd; /* Small end of the recommended usage range
|
||||
(exclusive), stored in 720/inch units
|
||||
* (decipoints). */
|
||||
public:
|
||||
|
@ -393,12 +393,12 @@ struct FeatureParamsStylisticSet
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
USHORT version; /* (set to 0): This corresponds to a “minor”
|
||||
UINT16 version; /* (set to 0): This corresponds to a “minor”
|
||||
* version number. Additional data may be
|
||||
* added to the end of this Feature Parameters
|
||||
* table in the future. */
|
||||
|
||||
USHORT uiNameID; /* The 'name' table name ID that specifies a
|
||||
UINT16 uiNameID; /* The 'name' table name ID that specifies a
|
||||
* string (or strings, for multiple languages)
|
||||
* for a user-interface label for this
|
||||
* feature. The values of uiLabelNameId and
|
||||
|
@ -426,25 +426,25 @@ struct FeatureParamsCharacterVariants
|
|||
characters.sanitize (c));
|
||||
}
|
||||
|
||||
USHORT format; /* Format number is set to 0. */
|
||||
USHORT featUILableNameID; /* The ‘name’ table name ID that
|
||||
UINT16 format; /* Format number is set to 0. */
|
||||
UINT16 featUILableNameID; /* The ‘name’ table name ID that
|
||||
* specifies a string (or strings,
|
||||
* for multiple languages) for a
|
||||
* user-interface label for this
|
||||
* feature. (May be nullptr.) */
|
||||
USHORT featUITooltipTextNameID;/* The ‘name’ table name ID that
|
||||
UINT16 featUITooltipTextNameID;/* The ‘name’ table name ID that
|
||||
* specifies a string (or strings,
|
||||
* for multiple languages) that an
|
||||
* application can use for tooltip
|
||||
* text for this feature. (May be
|
||||
* nullptr.) */
|
||||
USHORT sampleTextNameID; /* The ‘name’ table name ID that
|
||||
UINT16 sampleTextNameID; /* The ‘name’ table name ID that
|
||||
* specifies sample text that
|
||||
* illustrates the effect of this
|
||||
* feature. (May be nullptr.) */
|
||||
USHORT numNamedParameters; /* Number of named parameters. (May
|
||||
UINT16 numNamedParameters; /* Number of named parameters. (May
|
||||
* be zero.) */
|
||||
USHORT firstParamUILabelNameID;/* The first ‘name’ table name ID
|
||||
UINT16 firstParamUILabelNameID;/* The first ‘name’ table name ID
|
||||
* used to specify strings for
|
||||
* user-interface labels for the
|
||||
* feature parameters. (Must be zero
|
||||
|
@ -562,7 +562,7 @@ struct Feature
|
|||
typedef RecordListOf<Feature> FeatureList;
|
||||
|
||||
|
||||
struct LookupFlag : USHORT
|
||||
struct LookupFlag : UINT16
|
||||
{
|
||||
enum Flags {
|
||||
RightToLeft = 0x0001u,
|
||||
|
@ -608,7 +608,7 @@ struct Lookup
|
|||
unsigned int flag = lookupFlag;
|
||||
if (unlikely (flag & LookupFlag::UseMarkFilteringSet))
|
||||
{
|
||||
const USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
|
||||
const UINT16 &markFilteringSet = StructAfter<UINT16> (subTable);
|
||||
flag += (markFilteringSet << 16);
|
||||
}
|
||||
return flag;
|
||||
|
@ -640,7 +640,7 @@ struct Lookup
|
|||
if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false);
|
||||
if (lookupFlag & LookupFlag::UseMarkFilteringSet)
|
||||
{
|
||||
USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
|
||||
UINT16 &markFilteringSet = StructAfter<UINT16> (subTable);
|
||||
markFilteringSet.set (lookup_props >> 16);
|
||||
}
|
||||
return_trace (true);
|
||||
|
@ -653,18 +653,18 @@ struct Lookup
|
|||
if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false);
|
||||
if (lookupFlag & LookupFlag::UseMarkFilteringSet)
|
||||
{
|
||||
const USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
|
||||
const UINT16 &markFilteringSet = StructAfter<UINT16> (subTable);
|
||||
if (!markFilteringSet.sanitize (c)) return_trace (false);
|
||||
}
|
||||
return_trace (true);
|
||||
}
|
||||
|
||||
private:
|
||||
USHORT lookupType; /* Different enumerations for GSUB and GPOS */
|
||||
USHORT lookupFlag; /* Lookup qualifiers */
|
||||
ArrayOf<Offset<> >
|
||||
UINT16 lookupType; /* Different enumerations for GSUB and GPOS */
|
||||
UINT16 lookupFlag; /* Lookup qualifiers */
|
||||
ArrayOf<Offset16>
|
||||
subTable; /* Array of SubTables */
|
||||
USHORT markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets
|
||||
UINT16 markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets
|
||||
* structure. This field is only present if bit
|
||||
* UseMarkFilteringSet of lookup flags is set. */
|
||||
public:
|
||||
|
@ -737,7 +737,7 @@ struct CoverageFormat1
|
|||
private:
|
||||
|
||||
protected:
|
||||
USHORT coverageFormat; /* Format identifier--format = 1 */
|
||||
UINT16 coverageFormat; /* Format identifier--format = 1 */
|
||||
SortedArrayOf<GlyphID>
|
||||
glyphArray; /* Array of GlyphIDs--in numerical order */
|
||||
public:
|
||||
|
@ -860,7 +860,7 @@ struct CoverageFormat2
|
|||
private:
|
||||
|
||||
protected:
|
||||
USHORT coverageFormat; /* Format identifier--format = 2 */
|
||||
UINT16 coverageFormat; /* Format identifier--format = 2 */
|
||||
SortedArrayOf<RangeRecord>
|
||||
rangeRecord; /* Array of glyph ranges--ordered by
|
||||
* Start GlyphID. rangeCount entries
|
||||
|
@ -985,7 +985,7 @@ struct Coverage
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
CoverageFormat1 format1;
|
||||
CoverageFormat2 format2;
|
||||
} u;
|
||||
|
@ -1047,9 +1047,9 @@ struct ClassDefFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT classFormat; /* Format identifier--format = 1 */
|
||||
UINT16 classFormat; /* Format identifier--format = 1 */
|
||||
GlyphID startGlyph; /* First GlyphID of the classValueArray */
|
||||
ArrayOf<USHORT>
|
||||
ArrayOf<UINT16>
|
||||
classValue; /* Array of Class Values--one per GlyphID */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (6, classValue);
|
||||
|
@ -1107,7 +1107,7 @@ struct ClassDefFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT classFormat; /* Format identifier--format = 2 */
|
||||
UINT16 classFormat; /* Format identifier--format = 2 */
|
||||
SortedArrayOf<RangeRecord>
|
||||
rangeRecord; /* Array of glyph ranges--ordered by
|
||||
* Start GlyphID */
|
||||
|
@ -1155,7 +1155,7 @@ struct ClassDef
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
ClassDefFormat1 format1;
|
||||
ClassDefFormat2 format2;
|
||||
} u;
|
||||
|
@ -1240,8 +1240,8 @@ struct VarRegionList
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT axisCount;
|
||||
USHORT regionCount;
|
||||
UINT16 axisCount;
|
||||
UINT16 regionCount;
|
||||
VarRegionAxis axesZ[VAR];
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (4, axesZ);
|
||||
|
@ -1265,13 +1265,13 @@ struct VarData
|
|||
unsigned int count = regionIndices.len;
|
||||
unsigned int scount = shortCount;
|
||||
|
||||
const BYTE *bytes = &StructAfter<BYTE> (regionIndices);
|
||||
const BYTE *row = bytes + inner * (scount + count);
|
||||
const UINT8 *bytes = &StructAfter<UINT8> (regionIndices);
|
||||
const UINT8 *row = bytes + inner * (scount + count);
|
||||
|
||||
float delta = 0.;
|
||||
unsigned int i = 0;
|
||||
|
||||
const SHORT *scursor = reinterpret_cast<const SHORT *> (row);
|
||||
const INT16 *scursor = reinterpret_cast<const INT16 *> (row);
|
||||
for (; i < scount; i++)
|
||||
{
|
||||
float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count);
|
||||
|
@ -1293,15 +1293,15 @@ struct VarData
|
|||
return_trace (c->check_struct (this) &&
|
||||
regionIndices.sanitize(c) &&
|
||||
shortCount <= regionIndices.len &&
|
||||
c->check_array (&StructAfter<BYTE> (regionIndices),
|
||||
c->check_array (&StructAfter<UINT8> (regionIndices),
|
||||
get_row_size (), itemCount));
|
||||
}
|
||||
|
||||
protected:
|
||||
USHORT itemCount;
|
||||
USHORT shortCount;
|
||||
ArrayOf<USHORT> regionIndices;
|
||||
BYTE bytesX[VAR];
|
||||
UINT16 itemCount;
|
||||
UINT16 shortCount;
|
||||
ArrayOf<UINT16> regionIndices;
|
||||
UINT8 bytesX[VAR];
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX);
|
||||
};
|
||||
|
@ -1337,9 +1337,9 @@ struct VariationStore
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format;
|
||||
UINT16 format;
|
||||
LOffsetTo<VarRegionList> regions;
|
||||
OffsetArrayOf<VarData, ULONG> dataSets;
|
||||
OffsetArrayOf<VarData, UINT32> dataSets;
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (8, dataSets);
|
||||
};
|
||||
|
@ -1366,8 +1366,8 @@ struct ConditionFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
USHORT axisIndex;
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
UINT16 axisIndex;
|
||||
F2DOT14 filterRangeMinValue;
|
||||
F2DOT14 filterRangeMaxValue;
|
||||
public:
|
||||
|
@ -1396,7 +1396,7 @@ struct Condition
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
ConditionFormat1 format1;
|
||||
} u;
|
||||
public:
|
||||
|
@ -1421,7 +1421,7 @@ struct ConditionSet
|
|||
}
|
||||
|
||||
protected:
|
||||
OffsetArrayOf<Condition, ULONG> conditions;
|
||||
OffsetArrayOf<Condition, UINT32> conditions;
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (2, conditions);
|
||||
};
|
||||
|
@ -1437,7 +1437,7 @@ struct FeatureTableSubstitutionRecord
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT featureIndex;
|
||||
UINT16 featureIndex;
|
||||
LOffsetTo<Feature> feature;
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
|
@ -1557,8 +1557,8 @@ struct HintingDevice
|
|||
inline unsigned int get_size (void) const
|
||||
{
|
||||
unsigned int f = deltaFormat;
|
||||
if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
|
||||
return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
|
||||
if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * UINT16::static_size;
|
||||
return UINT16::static_size * (4 + ((endSize - startSize) >> (4 - f)));
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
|
@ -1603,14 +1603,14 @@ struct HintingDevice
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT startSize; /* Smallest size to correct--in ppem */
|
||||
USHORT endSize; /* Largest size to correct--in ppem */
|
||||
USHORT deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3
|
||||
UINT16 startSize; /* Smallest size to correct--in ppem */
|
||||
UINT16 endSize; /* Largest size to correct--in ppem */
|
||||
UINT16 deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3
|
||||
* 1 Signed 2-bit value, 8 values per uint16
|
||||
* 2 Signed 4-bit value, 4 values per uint16
|
||||
* 3 Signed 8-bit value, 2 values per uint16
|
||||
*/
|
||||
USHORT deltaValue[VAR]; /* Array of compressed data */
|
||||
UINT16 deltaValue[VAR]; /* Array of compressed data */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (6, deltaValue);
|
||||
};
|
||||
|
@ -1641,9 +1641,9 @@ struct VariationDevice
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT outerIndex;
|
||||
USHORT innerIndex;
|
||||
USHORT deltaFormat; /* Format identifier for this table: 0x0x8000 */
|
||||
UINT16 outerIndex;
|
||||
UINT16 innerIndex;
|
||||
UINT16 deltaFormat; /* Format identifier for this table: 0x0x8000 */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
|
@ -1651,10 +1651,10 @@ struct VariationDevice
|
|||
struct DeviceHeader
|
||||
{
|
||||
protected:
|
||||
USHORT reserved1;
|
||||
USHORT reserved2;
|
||||
UINT16 reserved1;
|
||||
UINT16 reserved2;
|
||||
public:
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace OT {
|
|||
* Attachment List Table
|
||||
*/
|
||||
|
||||
typedef ArrayOf<USHORT> AttachPoint; /* Array of contour point indices--in
|
||||
typedef ArrayOf<UINT16> AttachPoint; /* Array of contour point indices--in
|
||||
* increasing numerical order */
|
||||
|
||||
struct AttachList
|
||||
|
@ -62,7 +62,7 @@ struct AttachList
|
|||
const AttachPoint &points = this+attachPoint[index];
|
||||
|
||||
if (point_count) {
|
||||
const USHORT *array = points.sub_array (start_offset, point_count);
|
||||
const UINT16 *array = points.sub_array (start_offset, point_count);
|
||||
unsigned int count = *point_count;
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
point_array[i] = array[i];
|
||||
|
@ -109,8 +109,8 @@ struct CaretValueFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT caretValueFormat; /* Format identifier--format = 1 */
|
||||
SHORT coordinate; /* X or Y value, in design units */
|
||||
UINT16 caretValueFormat; /* Format identifier--format = 1 */
|
||||
INT16 coordinate; /* X or Y value, in design units */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
@ -136,8 +136,8 @@ struct CaretValueFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT caretValueFormat; /* Format identifier--format = 2 */
|
||||
USHORT caretValuePoint; /* Contour point index on glyph */
|
||||
UINT16 caretValueFormat; /* Format identifier--format = 2 */
|
||||
UINT16 caretValuePoint; /* Contour point index on glyph */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
@ -160,8 +160,8 @@ struct CaretValueFormat3
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT caretValueFormat; /* Format identifier--format = 3 */
|
||||
SHORT coordinate; /* X or Y value, in design units */
|
||||
UINT16 caretValueFormat; /* Format identifier--format = 3 */
|
||||
INT16 coordinate; /* X or Y value, in design units */
|
||||
OffsetTo<Device>
|
||||
deviceTable; /* Offset to Device table for X or Y
|
||||
* value--from beginning of CaretValue
|
||||
|
@ -199,7 +199,7 @@ struct CaretValue
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
CaretValueFormat1 format1;
|
||||
CaretValueFormat2 format2;
|
||||
CaretValueFormat3 format3;
|
||||
|
@ -294,7 +294,7 @@ struct MarkGlyphSetsFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
ArrayOf<LOffsetTo<Coverage> >
|
||||
coverage; /* Array of long offsets to mark set
|
||||
* coverage tables */
|
||||
|
@ -324,7 +324,7 @@ struct MarkGlyphSets
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
MarkGlyphSetsFormat1 format1;
|
||||
} u;
|
||||
public:
|
||||
|
|
|
@ -51,11 +51,11 @@ enum attach_type_t {
|
|||
|
||||
/* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
|
||||
|
||||
typedef USHORT Value;
|
||||
typedef UINT16 Value;
|
||||
|
||||
typedef Value ValueRecord[VAR];
|
||||
|
||||
struct ValueFormat : USHORT
|
||||
struct ValueFormat : UINT16
|
||||
{
|
||||
enum Flags {
|
||||
xPlacement = 0x0001u, /* Includes horizontal adjustment for placement */
|
||||
|
@ -74,14 +74,14 @@ struct ValueFormat : USHORT
|
|||
|
||||
/* All fields are options. Only those available advance the value pointer. */
|
||||
#if 0
|
||||
SHORT xPlacement; /* Horizontal adjustment for
|
||||
INT16 xPlacement; /* Horizontal adjustment for
|
||||
* placement--in design units */
|
||||
SHORT yPlacement; /* Vertical adjustment for
|
||||
INT16 yPlacement; /* Vertical adjustment for
|
||||
* placement--in design units */
|
||||
SHORT xAdvance; /* Horizontal adjustment for
|
||||
INT16 xAdvance; /* Horizontal adjustment for
|
||||
* advance--in design units (only used
|
||||
* for horizontal writing) */
|
||||
SHORT yAdvance; /* Vertical adjustment for advance--in
|
||||
INT16 yAdvance; /* Vertical adjustment for advance--in
|
||||
* design units (only used for vertical
|
||||
* writing) */
|
||||
Offset xPlaDevice; /* Offset to Device table for
|
||||
|
@ -178,8 +178,8 @@ struct ValueFormat : USHORT
|
|||
static inline const OffsetTo<Device>& get_device (const Value* value)
|
||||
{ return *CastP<OffsetTo<Device> > (value); }
|
||||
|
||||
static inline const SHORT& get_short (const Value* value)
|
||||
{ return *CastP<SHORT> (value); }
|
||||
static inline const INT16& get_short (const Value* value)
|
||||
{ return *CastP<INT16> (value); }
|
||||
|
||||
public:
|
||||
|
||||
|
@ -247,9 +247,9 @@ struct AnchorFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
SHORT xCoordinate; /* Horizontal value--in design units */
|
||||
SHORT yCoordinate; /* Vertical value--in design units */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
INT16 xCoordinate; /* Horizontal value--in design units */
|
||||
INT16 yCoordinate; /* Vertical value--in design units */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
|
@ -278,10 +278,10 @@ struct AnchorFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 2 */
|
||||
SHORT xCoordinate; /* Horizontal value--in design units */
|
||||
SHORT yCoordinate; /* Vertical value--in design units */
|
||||
USHORT anchorPoint; /* Index to glyph contour point */
|
||||
UINT16 format; /* Format identifier--format = 2 */
|
||||
INT16 xCoordinate; /* Horizontal value--in design units */
|
||||
INT16 yCoordinate; /* Vertical value--in design units */
|
||||
UINT16 anchorPoint; /* Index to glyph contour point */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (8);
|
||||
};
|
||||
|
@ -308,9 +308,9 @@ struct AnchorFormat3
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 3 */
|
||||
SHORT xCoordinate; /* Horizontal value--in design units */
|
||||
SHORT yCoordinate; /* Vertical value--in design units */
|
||||
UINT16 format; /* Format identifier--format = 3 */
|
||||
INT16 xCoordinate; /* Horizontal value--in design units */
|
||||
INT16 yCoordinate; /* Vertical value--in design units */
|
||||
OffsetTo<Device>
|
||||
xDeviceTable; /* Offset to Device table for X
|
||||
* coordinate-- from beginning of
|
||||
|
@ -351,7 +351,7 @@ struct Anchor
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
AnchorFormat1 format1;
|
||||
AnchorFormat2 format2;
|
||||
AnchorFormat3 format3;
|
||||
|
@ -382,7 +382,7 @@ struct AnchorMatrix
|
|||
return_trace (true);
|
||||
}
|
||||
|
||||
USHORT rows; /* Number of rows */
|
||||
UINT16 rows; /* Number of rows */
|
||||
protected:
|
||||
OffsetTo<Anchor>
|
||||
matrixZ[VAR]; /* Matrix of offsets to Anchor tables--
|
||||
|
@ -403,7 +403,7 @@ struct MarkRecord
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT klass; /* Class defined for this mark */
|
||||
UINT16 klass; /* Class defined for this mark */
|
||||
OffsetTo<Anchor>
|
||||
markAnchor; /* Offset to Anchor table--from
|
||||
* beginning of MarkArray table */
|
||||
|
@ -492,7 +492,7 @@ struct SinglePosFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of subtable */
|
||||
|
@ -544,13 +544,13 @@ struct SinglePosFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 2 */
|
||||
UINT16 format; /* Format identifier--format = 2 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of subtable */
|
||||
ValueFormat valueFormat; /* Defines the types of data in the
|
||||
* ValueRecord */
|
||||
USHORT valueCount; /* Number of ValueRecords */
|
||||
UINT16 valueCount; /* Number of ValueRecords */
|
||||
ValueRecord values; /* Array of ValueRecords--positioning
|
||||
* values applied to glyphs */
|
||||
public:
|
||||
|
@ -573,7 +573,7 @@ struct SinglePos
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
SinglePosFormat1 format1;
|
||||
SinglePosFormat2 format2;
|
||||
} u;
|
||||
|
@ -604,7 +604,7 @@ struct PairSet
|
|||
TRACE_COLLECT_GLYPHS (this);
|
||||
unsigned int len1 = valueFormats[0].get_len ();
|
||||
unsigned int len2 = valueFormats[1].get_len ();
|
||||
unsigned int record_size = USHORT::static_size * (1 + len1 + len2);
|
||||
unsigned int record_size = UINT16::static_size * (1 + len1 + len2);
|
||||
|
||||
const PairValueRecord *record = CastP<PairValueRecord> (arrayZ);
|
||||
unsigned int count = len;
|
||||
|
@ -623,7 +623,7 @@ struct PairSet
|
|||
hb_buffer_t *buffer = c->buffer;
|
||||
unsigned int len1 = valueFormats[0].get_len ();
|
||||
unsigned int len2 = valueFormats[1].get_len ();
|
||||
unsigned int record_size = USHORT::static_size * (1 + len1 + len2);
|
||||
unsigned int record_size = UINT16::static_size * (1 + len1 + len2);
|
||||
|
||||
const PairValueRecord *record_array = CastP<PairValueRecord> (arrayZ);
|
||||
unsigned int count = len;
|
||||
|
@ -668,7 +668,7 @@ struct PairSet
|
|||
{
|
||||
TRACE_SANITIZE (this);
|
||||
if (!(c->check_struct (this)
|
||||
&& c->check_array (arrayZ, USHORT::static_size * closure->stride, len))) return_trace (false);
|
||||
&& c->check_array (arrayZ, UINT16::static_size * closure->stride, len))) return_trace (false);
|
||||
|
||||
unsigned int count = len;
|
||||
const PairValueRecord *record = CastP<PairValueRecord> (arrayZ);
|
||||
|
@ -677,8 +677,8 @@ struct PairSet
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT len; /* Number of PairValueRecords */
|
||||
USHORT arrayZ[VAR]; /* Array of PairValueRecords--ordered
|
||||
UINT16 len; /* Number of PairValueRecords */
|
||||
UINT16 arrayZ[VAR]; /* Array of PairValueRecords--ordered
|
||||
* by GlyphID of the second glyph */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (2, arrayZ);
|
||||
|
@ -733,7 +733,7 @@ struct PairPosFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of subtable */
|
||||
|
@ -823,7 +823,7 @@ struct PairPosFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 2 */
|
||||
UINT16 format; /* Format identifier--format = 2 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of subtable */
|
||||
|
@ -841,9 +841,9 @@ struct PairPosFormat2
|
|||
classDef2; /* Offset to ClassDef table--from
|
||||
* beginning of PairPos subtable--for
|
||||
* the second glyph of the pair */
|
||||
USHORT class1Count; /* Number of classes in ClassDef1
|
||||
UINT16 class1Count; /* Number of classes in ClassDef1
|
||||
* table--includes Class0 */
|
||||
USHORT class2Count; /* Number of classes in ClassDef2
|
||||
UINT16 class2Count; /* Number of classes in ClassDef2
|
||||
* table--includes Class0 */
|
||||
ValueRecord values; /* Matrix of value pairs:
|
||||
* class1-major, class2-minor,
|
||||
|
@ -868,7 +868,7 @@ struct PairPos
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
PairPosFormat1 format1;
|
||||
PairPosFormat2 format2;
|
||||
} u;
|
||||
|
@ -1022,7 +1022,7 @@ struct CursivePosFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of subtable */
|
||||
|
@ -1048,7 +1048,7 @@ struct CursivePos
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
CursivePosFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -1113,14 +1113,14 @@ struct MarkBasePosFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
markCoverage; /* Offset to MarkCoverage table--from
|
||||
* beginning of MarkBasePos subtable */
|
||||
OffsetTo<Coverage>
|
||||
baseCoverage; /* Offset to BaseCoverage table--from
|
||||
* beginning of MarkBasePos subtable */
|
||||
USHORT classCount; /* Number of classes defined for marks */
|
||||
UINT16 classCount; /* Number of classes defined for marks */
|
||||
OffsetTo<MarkArray>
|
||||
markArray; /* Offset to MarkArray table--from
|
||||
* beginning of MarkBasePos subtable */
|
||||
|
@ -1146,7 +1146,7 @@ struct MarkBasePos
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
MarkBasePosFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -1230,7 +1230,7 @@ struct MarkLigPosFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
markCoverage; /* Offset to Mark Coverage table--from
|
||||
* beginning of MarkLigPos subtable */
|
||||
|
@ -1238,7 +1238,7 @@ struct MarkLigPosFormat1
|
|||
ligatureCoverage; /* Offset to Ligature Coverage
|
||||
* table--from beginning of MarkLigPos
|
||||
* subtable */
|
||||
USHORT classCount; /* Number of defined mark classes */
|
||||
UINT16 classCount; /* Number of defined mark classes */
|
||||
OffsetTo<MarkArray>
|
||||
markArray; /* Offset to MarkArray table--from
|
||||
* beginning of MarkLigPos subtable */
|
||||
|
@ -1264,7 +1264,7 @@ struct MarkLigPos
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
MarkLigPosFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -1344,7 +1344,7 @@ struct MarkMarkPosFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
mark1Coverage; /* Offset to Combining Mark1 Coverage
|
||||
* table--from beginning of MarkMarkPos
|
||||
|
@ -1353,7 +1353,7 @@ struct MarkMarkPosFormat1
|
|||
mark2Coverage; /* Offset to Combining Mark2 Coverage
|
||||
* table--from beginning of MarkMarkPos
|
||||
* subtable */
|
||||
USHORT classCount; /* Number of defined mark classes */
|
||||
UINT16 classCount; /* Number of defined mark classes */
|
||||
OffsetTo<MarkArray>
|
||||
mark1Array; /* Offset to Mark1Array table--from
|
||||
* beginning of MarkMarkPos subtable */
|
||||
|
@ -1379,7 +1379,7 @@ struct MarkMarkPos
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
MarkMarkPosFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -1438,7 +1438,7 @@ struct PosLookupSubTable
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT sub_format;
|
||||
UINT16 sub_format;
|
||||
SinglePos single;
|
||||
PairPos pair;
|
||||
CursivePos cursive;
|
||||
|
|
|
@ -44,7 +44,7 @@ struct SingleSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
/* TODO Switch to range-based API to work around malicious fonts.
|
||||
* https://github.com/behdad/harfbuzz/issues/363 */
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
hb_codepoint_t glyph_id = iter.get_glyph ();
|
||||
if (c->glyphs->has (glyph_id))
|
||||
c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
|
||||
|
@ -58,7 +58,7 @@ struct SingleSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
/* TODO Switch to range-based API to work around malicious fonts.
|
||||
* https://github.com/behdad/harfbuzz/issues/363 */
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
hb_codepoint_t glyph_id = iter.get_glyph ();
|
||||
c->input->add (glyph_id);
|
||||
c->output->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
|
||||
|
@ -110,11 +110,11 @@ struct SingleSubstFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of Substitution table */
|
||||
SHORT deltaGlyphID; /* Add to original GlyphID to get
|
||||
INT16 deltaGlyphID; /* Add to original GlyphID to get
|
||||
* substitute GlyphID */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
|
@ -130,7 +130,7 @@ struct SingleSubstFormat2
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
if (c->glyphs->has (iter.get_glyph ()))
|
||||
c->glyphs->add (substitute[iter.get_coverage ()]);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ struct SingleSubstFormat2
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
c->input->add (iter.get_glyph ());
|
||||
c->output->add (substitute[iter.get_coverage ()]);
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ struct SingleSubstFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 2 */
|
||||
UINT16 format; /* Format identifier--format = 2 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of Substitution table */
|
||||
|
@ -249,7 +249,7 @@ struct SingleSubst
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
SingleSubstFormat1 format1;
|
||||
SingleSubstFormat2 format2;
|
||||
} u;
|
||||
|
@ -287,7 +287,7 @@ struct Sequence
|
|||
return_trace (true);
|
||||
}
|
||||
/* Spec disallows this, but Uniscribe allows it.
|
||||
* https://github.com/behdad/harfbuzz/issues/253 */
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/253 */
|
||||
else if (unlikely (count == 0))
|
||||
{
|
||||
c->buffer->delete_glyph ();
|
||||
|
@ -339,7 +339,7 @@ struct MultipleSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
if (c->glyphs->has (iter.get_glyph ()))
|
||||
(this+sequence[iter.get_coverage ()]).closure (c);
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ struct MultipleSubstFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of Substitution table */
|
||||
|
@ -442,7 +442,7 @@ struct MultipleSubst
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
MultipleSubstFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -461,7 +461,7 @@ struct AlternateSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
if (c->glyphs->has (iter.get_glyph ())) {
|
||||
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
|
||||
unsigned int count = alt_set.len;
|
||||
|
@ -479,7 +479,7 @@ struct AlternateSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
c->input->add (iter.get_glyph ());
|
||||
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
|
||||
unsigned int count = alt_set.len;
|
||||
|
@ -552,7 +552,7 @@ struct AlternateSubstFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of Substitution table */
|
||||
|
@ -594,7 +594,7 @@ struct AlternateSubst
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
AlternateSubstFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -792,7 +792,7 @@ struct LigatureSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
if (c->glyphs->has (iter.get_glyph ()))
|
||||
(this+ligatureSet[iter.get_coverage ()]).closure (c);
|
||||
}
|
||||
|
@ -806,7 +806,7 @@ struct LigatureSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
c->input->add (iter.get_glyph ());
|
||||
(this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c);
|
||||
}
|
||||
|
@ -868,7 +868,7 @@ struct LigatureSubstFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of Substitution table */
|
||||
|
@ -918,7 +918,7 @@ struct LigatureSubst
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
LigatureSubstFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -961,7 +961,7 @@ struct ReverseChainSingleSubstFormat1
|
|||
for (iter.init (this+coverage); iter.more (); iter.next ())
|
||||
{
|
||||
if (unlikely (iter.get_coverage () >= count))
|
||||
break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
|
||||
break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
|
||||
if (c->glyphs->has (iter.get_glyph ()))
|
||||
c->glyphs->add (substitute[iter.get_coverage ()]);
|
||||
}
|
||||
|
@ -1016,11 +1016,11 @@ struct ReverseChainSingleSubstFormat1
|
|||
|
||||
unsigned int start_index = 0, end_index = 0;
|
||||
if (match_backtrack (c,
|
||||
backtrack.len, (USHORT *) backtrack.array,
|
||||
backtrack.len, (UINT16 *) backtrack.array,
|
||||
match_coverage, this,
|
||||
&start_index) &&
|
||||
match_lookahead (c,
|
||||
lookahead.len, (USHORT *) lookahead.array,
|
||||
lookahead.len, (UINT16 *) lookahead.array,
|
||||
match_coverage, this,
|
||||
1, &end_index))
|
||||
{
|
||||
|
@ -1048,7 +1048,7 @@ struct ReverseChainSingleSubstFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of table */
|
||||
|
@ -1082,7 +1082,7 @@ struct ReverseChainSingleSubst
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
ReverseChainSingleSubstFormat1 format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -1128,7 +1128,7 @@ struct SubstLookupSubTable
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT sub_format;
|
||||
UINT16 sub_format;
|
||||
SingleSubst single;
|
||||
MultipleSubst multiple;
|
||||
AlternateSubst alternate;
|
||||
|
@ -1280,9 +1280,11 @@ struct SubstLookup : Lookup
|
|||
if (unlikely (get_type () == SubstLookupSubTable::Extension))
|
||||
{
|
||||
/* The spec says all subtables of an Extension lookup should
|
||||
* have the same type. This is specially important if one has
|
||||
* a reverse type! */
|
||||
* have the same type, which shall not be the Extension type
|
||||
* itself. This is specially important if one has a reverse type! */
|
||||
unsigned int type = get_subtable (0).u.extension.get_type ();
|
||||
if (unlikely (type == SubstLookupSubTable::Extension))
|
||||
return_trace (false);
|
||||
unsigned int count = get_subtable_count ();
|
||||
for (unsigned int i = 1; i < count; i++)
|
||||
if (get_subtable (i).u.extension.get_type () != type)
|
||||
|
|
|
@ -234,7 +234,7 @@ struct hb_apply_context_t :
|
|||
match_func (nullptr),
|
||||
match_data (nullptr) {};
|
||||
|
||||
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
|
||||
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data);
|
||||
|
||||
inline void set_ignore_zwnj (bool ignore_zwnj_) { ignore_zwnj = ignore_zwnj_; }
|
||||
inline void set_ignore_zwj (bool ignore_zwj_) { ignore_zwj = ignore_zwj_; }
|
||||
|
@ -252,7 +252,7 @@ struct hb_apply_context_t :
|
|||
};
|
||||
|
||||
inline may_match_t may_match (const hb_glyph_info_t &info,
|
||||
const USHORT *glyph_data) const
|
||||
const UINT16 *glyph_data) const
|
||||
{
|
||||
if (!(info.mask & mask) ||
|
||||
(syllable && syllable != info.syllable ()))
|
||||
|
@ -315,7 +315,7 @@ struct hb_apply_context_t :
|
|||
}
|
||||
inline void set_match_func (matcher_t::match_func_t match_func_,
|
||||
const void *match_data_,
|
||||
const USHORT glyph_data[])
|
||||
const UINT16 glyph_data[])
|
||||
{
|
||||
matcher.set_match_func (match_func_, match_data_);
|
||||
match_glyph_data = glyph_data;
|
||||
|
@ -398,7 +398,7 @@ struct hb_apply_context_t :
|
|||
protected:
|
||||
hb_apply_context_t *c;
|
||||
matcher_t matcher;
|
||||
const USHORT *match_glyph_data;
|
||||
const UINT16 *match_glyph_data;
|
||||
|
||||
unsigned int num_items;
|
||||
unsigned int end;
|
||||
|
@ -413,7 +413,7 @@ struct hb_apply_context_t :
|
|||
bool stop_sublookup_iteration (return_t r) const { return r; }
|
||||
return_t recurse (unsigned int lookup_index)
|
||||
{
|
||||
if (unlikely (nesting_level_left == 0 || !recurse_func))
|
||||
if (unlikely (nesting_level_left == 0 || !recurse_func || buffer->max_ops-- <= 0))
|
||||
return default_return_value ();
|
||||
|
||||
nesting_level_left--;
|
||||
|
@ -568,9 +568,9 @@ struct hb_apply_context_t :
|
|||
|
||||
|
||||
|
||||
typedef bool (*intersects_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data);
|
||||
typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data);
|
||||
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
|
||||
typedef bool (*intersects_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data);
|
||||
typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data);
|
||||
typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data);
|
||||
|
||||
struct ContextClosureFuncs
|
||||
{
|
||||
|
@ -586,16 +586,16 @@ struct ContextApplyFuncs
|
|||
};
|
||||
|
||||
|
||||
static inline bool intersects_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED)
|
||||
static inline bool intersects_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED)
|
||||
{
|
||||
return glyphs->has (value);
|
||||
}
|
||||
static inline bool intersects_class (hb_set_t *glyphs, const USHORT &value, const void *data)
|
||||
static inline bool intersects_class (hb_set_t *glyphs, const UINT16 &value, const void *data)
|
||||
{
|
||||
const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
|
||||
return class_def.intersects_class (glyphs, value);
|
||||
}
|
||||
static inline bool intersects_coverage (hb_set_t *glyphs, const USHORT &value, const void *data)
|
||||
static inline bool intersects_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data)
|
||||
{
|
||||
const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
|
||||
return (data+coverage).intersects (glyphs);
|
||||
|
@ -603,7 +603,7 @@ static inline bool intersects_coverage (hb_set_t *glyphs, const USHORT &value, c
|
|||
|
||||
static inline bool intersects_array (hb_closure_context_t *c,
|
||||
unsigned int count,
|
||||
const USHORT values[],
|
||||
const UINT16 values[],
|
||||
intersects_func_t intersects_func,
|
||||
const void *intersects_data)
|
||||
{
|
||||
|
@ -614,16 +614,16 @@ static inline bool intersects_array (hb_closure_context_t *c,
|
|||
}
|
||||
|
||||
|
||||
static inline void collect_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED)
|
||||
static inline void collect_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED)
|
||||
{
|
||||
glyphs->add (value);
|
||||
}
|
||||
static inline void collect_class (hb_set_t *glyphs, const USHORT &value, const void *data)
|
||||
static inline void collect_class (hb_set_t *glyphs, const UINT16 &value, const void *data)
|
||||
{
|
||||
const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
|
||||
class_def.add_class (glyphs, value);
|
||||
}
|
||||
static inline void collect_coverage (hb_set_t *glyphs, const USHORT &value, const void *data)
|
||||
static inline void collect_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data)
|
||||
{
|
||||
const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
|
||||
(data+coverage).add_coverage (glyphs);
|
||||
|
@ -631,7 +631,7 @@ static inline void collect_coverage (hb_set_t *glyphs, const USHORT &value, cons
|
|||
static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED,
|
||||
hb_set_t *glyphs,
|
||||
unsigned int count,
|
||||
const USHORT values[],
|
||||
const UINT16 values[],
|
||||
collect_glyphs_func_t collect_func,
|
||||
const void *collect_data)
|
||||
{
|
||||
|
@ -640,16 +640,16 @@ static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED,
|
|||
}
|
||||
|
||||
|
||||
static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const void *data HB_UNUSED)
|
||||
static inline bool match_glyph (hb_codepoint_t glyph_id, const UINT16 &value, const void *data HB_UNUSED)
|
||||
{
|
||||
return glyph_id == value;
|
||||
}
|
||||
static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
|
||||
static inline bool match_class (hb_codepoint_t glyph_id, const UINT16 &value, const void *data)
|
||||
{
|
||||
const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
|
||||
return class_def.get_class (glyph_id) == value;
|
||||
}
|
||||
static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
|
||||
static inline bool match_coverage (hb_codepoint_t glyph_id, const UINT16 &value, const void *data)
|
||||
{
|
||||
const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
|
||||
return (data+coverage).get_coverage (glyph_id) != NOT_COVERED;
|
||||
|
@ -657,7 +657,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value,
|
|||
|
||||
static inline bool would_match_input (hb_would_apply_context_t *c,
|
||||
unsigned int count, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
match_func_t match_func,
|
||||
const void *match_data)
|
||||
{
|
||||
|
@ -672,7 +672,7 @@ static inline bool would_match_input (hb_would_apply_context_t *c,
|
|||
}
|
||||
static inline bool match_input (hb_apply_context_t *c,
|
||||
unsigned int count, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
match_func_t match_func,
|
||||
const void *match_data,
|
||||
unsigned int *end_offset,
|
||||
|
@ -711,7 +711,7 @@ static inline bool match_input (hb_apply_context_t *c,
|
|||
* o If two marks want to ligate and they belong to different components of the
|
||||
* same ligature glyph, and said ligature glyph is to be ignored according to
|
||||
* mark-filtering rules, then allow.
|
||||
* https://github.com/behdad/harfbuzz/issues/545
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/545
|
||||
*/
|
||||
|
||||
bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->cur());
|
||||
|
@ -896,7 +896,7 @@ static inline bool ligate_input (hb_apply_context_t *c,
|
|||
|
||||
static inline bool match_backtrack (hb_apply_context_t *c,
|
||||
unsigned int count,
|
||||
const USHORT backtrack[],
|
||||
const UINT16 backtrack[],
|
||||
match_func_t match_func,
|
||||
const void *match_data,
|
||||
unsigned int *match_start)
|
||||
|
@ -918,7 +918,7 @@ static inline bool match_backtrack (hb_apply_context_t *c,
|
|||
|
||||
static inline bool match_lookahead (hb_apply_context_t *c,
|
||||
unsigned int count,
|
||||
const USHORT lookahead[],
|
||||
const UINT16 lookahead[],
|
||||
match_func_t match_func,
|
||||
const void *match_data,
|
||||
unsigned int offset,
|
||||
|
@ -949,9 +949,9 @@ struct LookupRecord
|
|||
return_trace (c->check_struct (this));
|
||||
}
|
||||
|
||||
USHORT sequenceIndex; /* Index into current glyph
|
||||
UINT16 sequenceIndex; /* Index into current glyph
|
||||
* sequence--first glyph = 0 */
|
||||
USHORT lookupListIndex; /* Lookup to apply to that
|
||||
UINT16 lookupListIndex; /* Lookup to apply to that
|
||||
* position--zero--based */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (4);
|
||||
|
@ -1002,7 +1002,11 @@ static inline bool apply_lookup (hb_apply_context_t *c,
|
|||
if (idx == 0 && lookupRecord[i].lookupListIndex == c->lookup_index)
|
||||
continue;
|
||||
|
||||
buffer->move_to (match_positions[idx]);
|
||||
if (unlikely (!buffer->move_to (match_positions[idx])))
|
||||
break;
|
||||
|
||||
if (unlikely (buffer->max_ops <= 0))
|
||||
break;
|
||||
|
||||
unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
|
||||
if (!c->recurse (lookupRecord[i].lookupListIndex))
|
||||
|
@ -1108,7 +1112,7 @@ struct ContextApplyLookupContext
|
|||
|
||||
static inline void context_closure_lookup (hb_closure_context_t *c,
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookupCount,
|
||||
const LookupRecord lookupRecord[],
|
||||
ContextClosureLookupContext &lookup_context)
|
||||
|
@ -1122,7 +1126,7 @@ static inline void context_closure_lookup (hb_closure_context_t *c,
|
|||
|
||||
static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookupCount,
|
||||
const LookupRecord lookupRecord[],
|
||||
ContextCollectGlyphsLookupContext &lookup_context)
|
||||
|
@ -1136,7 +1140,7 @@ static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c
|
|||
|
||||
static inline bool context_would_apply_lookup (hb_would_apply_context_t *c,
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookupCount HB_UNUSED,
|
||||
const LookupRecord lookupRecord[] HB_UNUSED,
|
||||
ContextApplyLookupContext &lookup_context)
|
||||
|
@ -1147,7 +1151,7 @@ static inline bool context_would_apply_lookup (hb_would_apply_context_t *c,
|
|||
}
|
||||
static inline bool context_apply_lookup (hb_apply_context_t *c,
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookupCount,
|
||||
const LookupRecord lookupRecord[],
|
||||
ContextApplyLookupContext &lookup_context)
|
||||
|
@ -1213,11 +1217,11 @@ struct Rule
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT inputCount; /* Total number of glyphs in input
|
||||
UINT16 inputCount; /* Total number of glyphs in input
|
||||
* glyph sequence--includes the first
|
||||
* glyph */
|
||||
USHORT lookupCount; /* Number of LookupRecords */
|
||||
USHORT inputZ[VAR]; /* Array of match inputs--start with
|
||||
UINT16 lookupCount; /* Number of LookupRecords */
|
||||
UINT16 inputZ[VAR]; /* Array of match inputs--start with
|
||||
* second glyph */
|
||||
LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
|
||||
* design order */
|
||||
|
@ -1357,7 +1361,7 @@ struct ContextFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of table */
|
||||
|
@ -1450,7 +1454,7 @@ struct ContextFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 2 */
|
||||
UINT16 format; /* Format identifier--format = 2 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of table */
|
||||
|
@ -1479,7 +1483,7 @@ struct ContextFormat3
|
|||
this
|
||||
};
|
||||
context_closure_lookup (c,
|
||||
glyphCount, (const USHORT *) (coverageZ + 1),
|
||||
glyphCount, (const UINT16 *) (coverageZ + 1),
|
||||
lookupCount, lookupRecord,
|
||||
lookup_context);
|
||||
}
|
||||
|
@ -1496,7 +1500,7 @@ struct ContextFormat3
|
|||
};
|
||||
|
||||
context_collect_glyphs_lookup (c,
|
||||
glyphCount, (const USHORT *) (coverageZ + 1),
|
||||
glyphCount, (const UINT16 *) (coverageZ + 1),
|
||||
lookupCount, lookupRecord,
|
||||
lookup_context);
|
||||
}
|
||||
|
@ -1510,7 +1514,7 @@ struct ContextFormat3
|
|||
{match_coverage},
|
||||
this
|
||||
};
|
||||
return_trace (context_would_apply_lookup (c, glyphCount, (const USHORT *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
|
||||
return_trace (context_would_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
|
||||
}
|
||||
|
||||
inline const Coverage &get_coverage (void) const
|
||||
|
@ -1529,7 +1533,7 @@ struct ContextFormat3
|
|||
{match_coverage},
|
||||
this
|
||||
};
|
||||
return_trace (context_apply_lookup (c, glyphCount, (const USHORT *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
|
||||
return_trace (context_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
|
||||
}
|
||||
|
||||
inline bool sanitize (hb_sanitize_context_t *c) const
|
||||
|
@ -1546,10 +1550,10 @@ struct ContextFormat3
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 3 */
|
||||
USHORT glyphCount; /* Number of glyphs in the input glyph
|
||||
UINT16 format; /* Format identifier--format = 3 */
|
||||
UINT16 glyphCount; /* Number of glyphs in the input glyph
|
||||
* sequence */
|
||||
USHORT lookupCount; /* Number of LookupRecords */
|
||||
UINT16 lookupCount; /* Number of LookupRecords */
|
||||
OffsetTo<Coverage>
|
||||
coverageZ[VAR]; /* Array of offsets to Coverage
|
||||
* table in glyph sequence order */
|
||||
|
@ -1576,7 +1580,7 @@ struct Context
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
ContextFormat1 format1;
|
||||
ContextFormat2 format2;
|
||||
ContextFormat3 format3;
|
||||
|
@ -1606,11 +1610,11 @@ struct ChainContextApplyLookupContext
|
|||
|
||||
static inline void chain_context_closure_lookup (hb_closure_context_t *c,
|
||||
unsigned int backtrackCount,
|
||||
const USHORT backtrack[],
|
||||
const UINT16 backtrack[],
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookaheadCount,
|
||||
const USHORT lookahead[],
|
||||
const UINT16 lookahead[],
|
||||
unsigned int lookupCount,
|
||||
const LookupRecord lookupRecord[],
|
||||
ChainContextClosureLookupContext &lookup_context)
|
||||
|
@ -1630,11 +1634,11 @@ static inline void chain_context_closure_lookup (hb_closure_context_t *c,
|
|||
|
||||
static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
|
||||
unsigned int backtrackCount,
|
||||
const USHORT backtrack[],
|
||||
const UINT16 backtrack[],
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookaheadCount,
|
||||
const USHORT lookahead[],
|
||||
const UINT16 lookahead[],
|
||||
unsigned int lookupCount,
|
||||
const LookupRecord lookupRecord[],
|
||||
ChainContextCollectGlyphsLookupContext &lookup_context)
|
||||
|
@ -1654,11 +1658,11 @@ static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_contex
|
|||
|
||||
static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c,
|
||||
unsigned int backtrackCount,
|
||||
const USHORT backtrack[] HB_UNUSED,
|
||||
const UINT16 backtrack[] HB_UNUSED,
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookaheadCount,
|
||||
const USHORT lookahead[] HB_UNUSED,
|
||||
const UINT16 lookahead[] HB_UNUSED,
|
||||
unsigned int lookupCount HB_UNUSED,
|
||||
const LookupRecord lookupRecord[] HB_UNUSED,
|
||||
ChainContextApplyLookupContext &lookup_context)
|
||||
|
@ -1671,11 +1675,11 @@ static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c
|
|||
|
||||
static inline bool chain_context_apply_lookup (hb_apply_context_t *c,
|
||||
unsigned int backtrackCount,
|
||||
const USHORT backtrack[],
|
||||
const UINT16 backtrack[],
|
||||
unsigned int inputCount, /* Including the first glyph (not matched) */
|
||||
const USHORT input[], /* Array of input values--start with second glyph */
|
||||
const UINT16 input[], /* Array of input values--start with second glyph */
|
||||
unsigned int lookaheadCount,
|
||||
const USHORT lookahead[],
|
||||
const UINT16 lookahead[],
|
||||
unsigned int lookupCount,
|
||||
const LookupRecord lookupRecord[],
|
||||
ChainContextApplyLookupContext &lookup_context)
|
||||
|
@ -1706,8 +1710,8 @@ struct ChainRule
|
|||
inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_CLOSURE (this);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
|
||||
const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
chain_context_closure_lookup (c,
|
||||
backtrack.len, backtrack.array,
|
||||
|
@ -1720,8 +1724,8 @@ struct ChainRule
|
|||
inline void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_COLLECT_GLYPHS (this);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
|
||||
const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
chain_context_collect_glyphs_lookup (c,
|
||||
backtrack.len, backtrack.array,
|
||||
|
@ -1734,8 +1738,8 @@ struct ChainRule
|
|||
inline bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_WOULD_APPLY (this);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
|
||||
const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
return_trace (chain_context_would_apply_lookup (c,
|
||||
backtrack.len, backtrack.array,
|
||||
|
@ -1747,8 +1751,8 @@ struct ChainRule
|
|||
inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
|
||||
{
|
||||
TRACE_APPLY (this);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
|
||||
const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
return_trace (chain_context_apply_lookup (c,
|
||||
backtrack.len, backtrack.array,
|
||||
|
@ -1761,23 +1765,23 @@ struct ChainRule
|
|||
{
|
||||
TRACE_SANITIZE (this);
|
||||
if (!backtrack.sanitize (c)) return_trace (false);
|
||||
const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
|
||||
const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
|
||||
if (!input.sanitize (c)) return_trace (false);
|
||||
const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
|
||||
const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
|
||||
if (!lookahead.sanitize (c)) return_trace (false);
|
||||
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
|
||||
return_trace (lookup.sanitize (c));
|
||||
}
|
||||
|
||||
protected:
|
||||
ArrayOf<USHORT>
|
||||
ArrayOf<UINT16>
|
||||
backtrack; /* Array of backtracking values
|
||||
* (to be matched before the input
|
||||
* sequence) */
|
||||
HeadlessArrayOf<USHORT>
|
||||
HeadlessArrayOf<UINT16>
|
||||
inputX; /* Array of input values (start with
|
||||
* second glyph) */
|
||||
ArrayOf<USHORT>
|
||||
ArrayOf<UINT16>
|
||||
lookaheadX; /* Array of lookahead values's (to be
|
||||
* matched after the input sequence) */
|
||||
ArrayOf<LookupRecord>
|
||||
|
@ -1914,7 +1918,7 @@ struct ChainContextFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 1 */
|
||||
UINT16 format; /* Format identifier--format = 1 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of table */
|
||||
|
@ -2029,7 +2033,7 @@ struct ChainContextFormat2
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 2 */
|
||||
UINT16 format; /* Format identifier--format = 2 */
|
||||
OffsetTo<Coverage>
|
||||
coverage; /* Offset to Coverage table--from
|
||||
* beginning of table */
|
||||
|
@ -2069,9 +2073,9 @@ struct ChainContextFormat3
|
|||
{this, this, this}
|
||||
};
|
||||
chain_context_closure_lookup (c,
|
||||
backtrack.len, (const USHORT *) backtrack.array,
|
||||
input.len, (const USHORT *) input.array + 1,
|
||||
lookahead.len, (const USHORT *) lookahead.array,
|
||||
backtrack.len, (const UINT16 *) backtrack.array,
|
||||
input.len, (const UINT16 *) input.array + 1,
|
||||
lookahead.len, (const UINT16 *) lookahead.array,
|
||||
lookup.len, lookup.array,
|
||||
lookup_context);
|
||||
}
|
||||
|
@ -2090,9 +2094,9 @@ struct ChainContextFormat3
|
|||
{this, this, this}
|
||||
};
|
||||
chain_context_collect_glyphs_lookup (c,
|
||||
backtrack.len, (const USHORT *) backtrack.array,
|
||||
input.len, (const USHORT *) input.array + 1,
|
||||
lookahead.len, (const USHORT *) lookahead.array,
|
||||
backtrack.len, (const UINT16 *) backtrack.array,
|
||||
input.len, (const UINT16 *) input.array + 1,
|
||||
lookahead.len, (const UINT16 *) lookahead.array,
|
||||
lookup.len, lookup.array,
|
||||
lookup_context);
|
||||
}
|
||||
|
@ -2109,9 +2113,9 @@ struct ChainContextFormat3
|
|||
{this, this, this}
|
||||
};
|
||||
return_trace (chain_context_would_apply_lookup (c,
|
||||
backtrack.len, (const USHORT *) backtrack.array,
|
||||
input.len, (const USHORT *) input.array + 1,
|
||||
lookahead.len, (const USHORT *) lookahead.array,
|
||||
backtrack.len, (const UINT16 *) backtrack.array,
|
||||
input.len, (const UINT16 *) input.array + 1,
|
||||
lookahead.len, (const UINT16 *) lookahead.array,
|
||||
lookup.len, lookup.array, lookup_context));
|
||||
}
|
||||
|
||||
|
@ -2136,9 +2140,9 @@ struct ChainContextFormat3
|
|||
{this, this, this}
|
||||
};
|
||||
return_trace (chain_context_apply_lookup (c,
|
||||
backtrack.len, (const USHORT *) backtrack.array,
|
||||
input.len, (const USHORT *) input.array + 1,
|
||||
lookahead.len, (const USHORT *) lookahead.array,
|
||||
backtrack.len, (const UINT16 *) backtrack.array,
|
||||
input.len, (const UINT16 *) input.array + 1,
|
||||
lookahead.len, (const UINT16 *) lookahead.array,
|
||||
lookup.len, lookup.array, lookup_context));
|
||||
}
|
||||
|
||||
|
@ -2156,7 +2160,7 @@ struct ChainContextFormat3
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier--format = 3 */
|
||||
UINT16 format; /* Format identifier--format = 3 */
|
||||
OffsetArrayOf<Coverage>
|
||||
backtrack; /* Array of coverage tables
|
||||
* in backtracking sequence, in glyph
|
||||
|
@ -2193,7 +2197,7 @@ struct ChainContext
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
ChainContextFormat1 format1;
|
||||
ChainContextFormat2 format2;
|
||||
ChainContextFormat3 format3;
|
||||
|
@ -2230,11 +2234,11 @@ struct ExtensionFormat1
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT format; /* Format identifier. Set to 1. */
|
||||
USHORT extensionLookupType; /* Lookup type of subtable referenced
|
||||
UINT16 format; /* Format identifier. Set to 1. */
|
||||
UINT16 extensionLookupType; /* Lookup type of subtable referenced
|
||||
* by ExtensionOffset (i.e. the
|
||||
* extension subtable). */
|
||||
ULONG extensionOffset; /* Offset to the extension subtable,
|
||||
UINT32 extensionOffset; /* Offset to the extension subtable,
|
||||
* of lookup type subtable. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (8);
|
||||
|
@ -2272,7 +2276,7 @@ struct Extension
|
|||
|
||||
protected:
|
||||
union {
|
||||
USHORT format; /* Format identifier */
|
||||
UINT16 format; /* Format identifier */
|
||||
ExtensionFormat1<T> format1;
|
||||
} u;
|
||||
};
|
||||
|
@ -2284,9 +2288,6 @@ struct Extension
|
|||
|
||||
struct GSUBGPOS
|
||||
{
|
||||
static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB;
|
||||
static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS;
|
||||
|
||||
inline unsigned int get_script_count (void) const
|
||||
{ return (this+scriptList).len; }
|
||||
inline const Tag& get_script_tag (unsigned int i) const
|
||||
|
|
|
@ -273,13 +273,13 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
|
|||
* what we do for joiners in Indic-like shapers, but since the
|
||||
* FVSes are GC=Mn, we have use a separate bit to remember them.
|
||||
* Fixes:
|
||||
* https://github.com/behdad/harfbuzz/issues/234 */
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/234 */
|
||||
else if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_HIDDEN;
|
||||
/* TAG characters need similar treatment. Fixes:
|
||||
* https://github.com/behdad/harfbuzz/issues/463 */
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/463 */
|
||||
else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN;
|
||||
/* COMBINING GRAPHEME JOINER should not be skipped; at least some times.
|
||||
* https://github.com/behdad/harfbuzz/issues/554 */
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/554 */
|
||||
else if (unlikely (u == 0x034Fu)) props |= UPROPS_MASK_HIDDEN;
|
||||
}
|
||||
else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
|
||||
|
@ -305,7 +305,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
|
|||
/* Recategorize emoji skin-tone modifiers as Unicode mark, so they
|
||||
* behave correctly in non-native directionality. They originally
|
||||
* are MODIFIER_SYMBOL. Fixes:
|
||||
* https://github.com/behdad/harfbuzz/issues/169
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/169
|
||||
*/
|
||||
if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
|
||||
{
|
||||
|
|
|
@ -601,6 +601,7 @@ unsigned int
|
|||
hb_ot_layout_table_get_lookup_count (hb_face_t *face,
|
||||
hb_tag_t table_tag)
|
||||
{
|
||||
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return 0;
|
||||
switch (table_tag)
|
||||
{
|
||||
case HB_OT_TAG_GSUB:
|
||||
|
|
|
@ -48,7 +48,7 @@ struct MathValueRecord
|
|||
}
|
||||
|
||||
protected:
|
||||
SHORT value; /* The X or Y value in design units */
|
||||
INT16 value; /* The X or Y value in design units */
|
||||
OffsetTo<Device> deviceTable; /* Offset to the device table - from the
|
||||
* beginning of parent table. May be nullptr.
|
||||
* Suggested format for device table is 1. */
|
||||
|
@ -154,10 +154,10 @@ struct MathConstants
|
|||
}
|
||||
|
||||
protected:
|
||||
SHORT percentScaleDown[2];
|
||||
USHORT minHeight[2];
|
||||
INT16 percentScaleDown[2];
|
||||
UINT16 minHeight[2];
|
||||
MathValueRecord mathValueRecords[51];
|
||||
SHORT radicalDegreeBottomRaisePercent;
|
||||
INT16 radicalDegreeBottomRaisePercent;
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (214);
|
||||
|
@ -279,7 +279,7 @@ struct MathKern
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT heightCount;
|
||||
UINT16 heightCount;
|
||||
MathValueRecord mathValueRecords[VAR]; /* Array of correction heights at
|
||||
* which the kern value changes.
|
||||
* Sorted by the height value in
|
||||
|
@ -425,7 +425,7 @@ struct MathGlyphVariantRecord
|
|||
|
||||
protected:
|
||||
GlyphID variantGlyph; /* Glyph ID for the variant. */
|
||||
USHORT advanceMeasurement; /* Advance width/height, in design units, of the
|
||||
UINT16 advanceMeasurement; /* Advance width/height, in design units, of the
|
||||
* variant, in the direction of requested
|
||||
* glyph extension. */
|
||||
|
||||
|
@ -433,7 +433,7 @@ struct MathGlyphVariantRecord
|
|||
DEFINE_SIZE_STATIC (4);
|
||||
};
|
||||
|
||||
struct PartFlags : USHORT
|
||||
struct PartFlags : UINT16
|
||||
{
|
||||
enum Flags {
|
||||
Extender = 0x0001u, /* If set, the part can be skipped or repeated. */
|
||||
|
@ -473,15 +473,15 @@ struct MathGlyphPartRecord
|
|||
|
||||
protected:
|
||||
GlyphID glyph; /* Glyph ID for the part. */
|
||||
USHORT startConnectorLength; /* Advance width/ height of the straight bar
|
||||
UINT16 startConnectorLength; /* Advance width/ height of the straight bar
|
||||
* connector material, in design units, is at
|
||||
* the beginning of the glyph, in the
|
||||
* direction of the extension. */
|
||||
USHORT endConnectorLength; /* Advance width/ height of the straight bar
|
||||
UINT16 endConnectorLength; /* Advance width/ height of the straight bar
|
||||
* connector material, in design units, is at
|
||||
* the end of the glyph, in the direction of
|
||||
* the extension. */
|
||||
USHORT fullAdvance; /* Full advance width/height for this part,
|
||||
UINT16 fullAdvance; /* Full advance width/height for this part,
|
||||
* in the direction of the extension.
|
||||
* In design units. */
|
||||
PartFlags partFlags; /* Part qualifiers. */
|
||||
|
@ -651,7 +651,7 @@ struct MathVariants
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT minConnectorOverlap; /* Minimum overlap of connecting
|
||||
UINT16 minConnectorOverlap; /* Minimum overlap of connecting
|
||||
* glyphs during glyph construction,
|
||||
* in design units. */
|
||||
OffsetTo<Coverage> vertGlyphCoverage; /* Offset to Coverage table -
|
||||
|
@ -660,10 +660,10 @@ struct MathVariants
|
|||
OffsetTo<Coverage> horizGlyphCoverage; /* Offset to Coverage table -
|
||||
* from the beginning of MathVariants
|
||||
* table. */
|
||||
USHORT vertGlyphCount; /* Number of glyphs for which
|
||||
UINT16 vertGlyphCount; /* Number of glyphs for which
|
||||
* information is provided for
|
||||
* vertically growing variants. */
|
||||
USHORT horizGlyphCount; /* Number of glyphs for which
|
||||
UINT16 horizGlyphCount; /* Number of glyphs for which
|
||||
* information is provided for
|
||||
* horizontally growing variants. */
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ struct maxp
|
|||
protected:
|
||||
FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
|
||||
* 0x00005000u or 0x00010000u. */
|
||||
USHORT numGlyphs; /* The number of glyphs in the font. */
|
||||
UINT16 numGlyphs; /* The number of glyphs in the font. */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (6);
|
||||
};
|
||||
|
|
|
@ -65,12 +65,12 @@ struct NameRecord
|
|||
return_trace (c->check_struct (this) && c->check_range ((char *) base, (unsigned int) length + offset));
|
||||
}
|
||||
|
||||
USHORT platformID; /* Platform ID. */
|
||||
USHORT encodingID; /* Platform-specific encoding ID. */
|
||||
USHORT languageID; /* Language ID. */
|
||||
USHORT nameID; /* Name ID. */
|
||||
USHORT length; /* String length (in bytes). */
|
||||
USHORT offset; /* String offset from start of storage area (in bytes). */
|
||||
UINT16 platformID; /* Platform ID. */
|
||||
UINT16 encodingID; /* Platform-specific encoding ID. */
|
||||
UINT16 languageID; /* Language ID. */
|
||||
UINT16 nameID; /* Name ID. */
|
||||
UINT16 length; /* String length (in bytes). */
|
||||
UINT16 offset; /* String offset from start of storage area (in bytes). */
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (12);
|
||||
};
|
||||
|
@ -123,9 +123,9 @@ struct name
|
|||
}
|
||||
|
||||
/* We only implement format 0 for now. */
|
||||
USHORT format; /* Format selector (=0/1). */
|
||||
USHORT count; /* Number of name records. */
|
||||
Offset<> stringOffset; /* Offset to start of string storage (from start of table). */
|
||||
UINT16 format; /* Format selector (=0/1). */
|
||||
UINT16 count; /* Number of name records. */
|
||||
Offset16 stringOffset; /* Offset to start of string storage (from start of table). */
|
||||
NameRecord nameRecord[VAR]; /* The name records where count is the number of records. */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (6, nameRecord);
|
||||
|
|
|
@ -50,50 +50,50 @@ struct os2
|
|||
}
|
||||
|
||||
public:
|
||||
USHORT version;
|
||||
UINT16 version;
|
||||
|
||||
/* Version 0 */
|
||||
SHORT xAvgCharWidth;
|
||||
USHORT usWeightClass;
|
||||
USHORT usWidthClass;
|
||||
USHORT fsType;
|
||||
SHORT ySubscriptXSize;
|
||||
SHORT ySubscriptYSize;
|
||||
SHORT ySubscriptXOffset;
|
||||
SHORT ySubscriptYOffset;
|
||||
SHORT ySuperscriptXSize;
|
||||
SHORT ySuperscriptYSize;
|
||||
SHORT ySuperscriptXOffset;
|
||||
SHORT ySuperscriptYOffset;
|
||||
SHORT yStrikeoutSize;
|
||||
SHORT yStrikeoutPosition;
|
||||
SHORT sFamilyClass;
|
||||
BYTE panose[10];
|
||||
ULONG ulUnicodeRange[4];
|
||||
INT16 xAvgCharWidth;
|
||||
UINT16 usWeightClass;
|
||||
UINT16 usWidthClass;
|
||||
UINT16 fsType;
|
||||
INT16 ySubscriptXSize;
|
||||
INT16 ySubscriptYSize;
|
||||
INT16 ySubscriptXOffset;
|
||||
INT16 ySubscriptYOffset;
|
||||
INT16 ySuperscriptXSize;
|
||||
INT16 ySuperscriptYSize;
|
||||
INT16 ySuperscriptXOffset;
|
||||
INT16 ySuperscriptYOffset;
|
||||
INT16 yStrikeoutSize;
|
||||
INT16 yStrikeoutPosition;
|
||||
INT16 sFamilyClass;
|
||||
UINT8 panose[10];
|
||||
UINT32 ulUnicodeRange[4];
|
||||
Tag achVendID;
|
||||
USHORT fsSelection;
|
||||
USHORT usFirstCharIndex;
|
||||
USHORT usLastCharIndex;
|
||||
SHORT sTypoAscender;
|
||||
SHORT sTypoDescender;
|
||||
SHORT sTypoLineGap;
|
||||
USHORT usWinAscent;
|
||||
USHORT usWinDescent;
|
||||
UINT16 fsSelection;
|
||||
UINT16 usFirstCharIndex;
|
||||
UINT16 usLastCharIndex;
|
||||
INT16 sTypoAscender;
|
||||
INT16 sTypoDescender;
|
||||
INT16 sTypoLineGap;
|
||||
UINT16 usWinAscent;
|
||||
UINT16 usWinDescent;
|
||||
|
||||
/* Version 1 */
|
||||
//ULONG ulCodePageRange1;
|
||||
//ULONG ulCodePageRange2;
|
||||
//UINT32 ulCodePageRange1;
|
||||
//UINT32 ulCodePageRange2;
|
||||
|
||||
/* Version 2 */
|
||||
//SHORT sxHeight;
|
||||
//SHORT sCapHeight;
|
||||
//USHORT usDefaultChar;
|
||||
//USHORT usBreakChar;
|
||||
//USHORT usMaxContext;
|
||||
//INT16 sxHeight;
|
||||
//INT16 sCapHeight;
|
||||
//UINT16 usDefaultChar;
|
||||
//UINT16 usBreakChar;
|
||||
//UINT16 usMaxContext;
|
||||
|
||||
/* Version 5 */
|
||||
//USHORT usLowerOpticalPointSize;
|
||||
//USHORT usUpperOpticalPointSize;
|
||||
//UINT16 usLowerOpticalPointSize;
|
||||
//UINT16 usUpperOpticalPointSize;
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (78);
|
||||
|
|
|
@ -56,10 +56,10 @@ struct postV2Tail
|
|||
return_trace (glyphNameIndex.sanitize (c));
|
||||
}
|
||||
|
||||
ArrayOf<USHORT>glyphNameIndex; /* This is not an offset, but is the
|
||||
ArrayOf<UINT16>glyphNameIndex; /* This is not an offset, but is the
|
||||
* ordinal number of the glyph in 'post'
|
||||
* string tables. */
|
||||
BYTE namesX[VAR]; /* Glyph names with length bytes [variable]
|
||||
UINT8 namesX[VAR]; /* Glyph names with length bytes [variable]
|
||||
* (a Pascal string). */
|
||||
|
||||
DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
|
||||
|
@ -84,8 +84,12 @@ struct post
|
|||
|
||||
struct accelerator_t
|
||||
{
|
||||
inline void init (const post *table, unsigned int post_len)
|
||||
inline void init (hb_face_t *face)
|
||||
{
|
||||
blob = Sanitizer<post>::sanitize (face->reference_table (HB_OT_TAG_post));
|
||||
const post *table = Sanitizer<post>::lock_instance (blob);
|
||||
unsigned int table_length = hb_blob_get_length (blob);
|
||||
|
||||
version = table->version.to_int ();
|
||||
index_to_offset.init ();
|
||||
if (version != 0x00020000)
|
||||
|
@ -96,7 +100,7 @@ struct post
|
|||
glyphNameIndex = &v2.glyphNameIndex;
|
||||
pool = &StructAfter<uint8_t> (v2.glyphNameIndex);
|
||||
|
||||
const uint8_t *end = (uint8_t *) table + post_len;
|
||||
const uint8_t *end = (uint8_t *) table + table_length;
|
||||
for (const uint8_t *data = pool; data < end && data + *data <= end; data += 1 + *data)
|
||||
{
|
||||
uint32_t *offset = index_to_offset.push ();
|
||||
|
@ -227,8 +231,10 @@ struct post
|
|||
return hb_string_t ((const char *) data, name_length);
|
||||
}
|
||||
|
||||
private:
|
||||
hb_blob_t *blob;
|
||||
uint32_t version;
|
||||
const ArrayOf<USHORT> *glyphNameIndex;
|
||||
const ArrayOf<UINT16> *glyphNameIndex;
|
||||
hb_prealloced_array_t<uint32_t, 1> index_to_offset;
|
||||
const uint8_t *pool;
|
||||
mutable uint16_t *gids_sorted_by_name;
|
||||
|
@ -255,16 +261,16 @@ struct post
|
|||
* from the value of this field. */
|
||||
FWORD underlineThickness; /* Suggested values for the underline
|
||||
thickness. */
|
||||
ULONG isFixedPitch; /* Set to 0 if the font is proportionally
|
||||
UINT32 isFixedPitch; /* Set to 0 if the font is proportionally
|
||||
* spaced, non-zero if the font is not
|
||||
* proportionally spaced (i.e. monospaced). */
|
||||
ULONG minMemType42; /* Minimum memory usage when an OpenType font
|
||||
UINT32 minMemType42; /* Minimum memory usage when an OpenType font
|
||||
* is downloaded. */
|
||||
ULONG maxMemType42; /* Maximum memory usage when an OpenType font
|
||||
UINT32 maxMemType42; /* Maximum memory usage when an OpenType font
|
||||
* is downloaded. */
|
||||
ULONG minMemType1; /* Minimum memory usage when an OpenType font
|
||||
UINT32 minMemType1; /* Minimum memory usage when an OpenType font
|
||||
* is downloaded as a Type 1 font. */
|
||||
ULONG maxMemType1; /* Maximum memory usage when an OpenType font
|
||||
UINT32 maxMemType1; /* Maximum memory usage when an OpenType font
|
||||
* is downloaded as a Type 1 font. */
|
||||
/*postV2Tail v2[VAR];*/
|
||||
DEFINE_SIZE_STATIC (32);
|
||||
|
|
|
@ -43,16 +43,16 @@
|
|||
#define OT_TABLE_END }
|
||||
#define OT_LABEL_START(Name) unsigned char Name[
|
||||
#define OT_LABEL_END ];
|
||||
#define OT_BYTE(u8) +1/*byte*/
|
||||
#define OT_USHORT(u16) +2/*bytes*/
|
||||
#define OT_UINT8(u8) +1/*byte*/
|
||||
#define OT_UINT16(u16) +2/*bytes*/
|
||||
#else
|
||||
#undef OT_MEASURE
|
||||
#define OT_TABLE_START TABLE_NAME = {
|
||||
#define OT_TABLE_END };
|
||||
#define OT_LABEL_START(Name) {
|
||||
#define OT_LABEL_END },
|
||||
#define OT_BYTE(u8) (u8),
|
||||
#define OT_USHORT(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu),
|
||||
#define OT_UINT8(u8) (u8),
|
||||
#define OT_UINT16(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu),
|
||||
#define OT_COUNT(Name, ItemSize) ((unsigned int) sizeof(((struct TABLE_NAME*)0)->Name) \
|
||||
/ (unsigned int)(ItemSize) \
|
||||
/* OT_ASSERT it's divisible (and positive). */)
|
||||
|
@ -80,24 +80,24 @@
|
|||
*/
|
||||
|
||||
#define OT_TAG(a,b,c,d) \
|
||||
OT_BYTE(a) OT_BYTE(b) OT_BYTE(c) OT_BYTE(d)
|
||||
OT_UINT8(a) OT_UINT8(b) OT_UINT8(c) OT_UINT8(d)
|
||||
|
||||
#define OT_OFFSET(From, To) /* Offset from From to To in bytes */ \
|
||||
OT_USHORT(OT_DISTANCE(From, To))
|
||||
OT_UINT16(OT_DISTANCE(From, To))
|
||||
|
||||
#define OT_GLYPHID /* GlyphID */ \
|
||||
OT_USHORT
|
||||
OT_UINT16
|
||||
|
||||
#define OT_UARRAY(Name, Items) \
|
||||
OT_LABEL_START(Name) \
|
||||
OT_USHORT(OT_COUNT(Name##Data, 2)) \
|
||||
OT_UINT16(OT_COUNT(Name##Data, 2)) \
|
||||
OT_LABEL(Name##Data) \
|
||||
Items \
|
||||
OT_LABEL_END
|
||||
|
||||
#define OT_UHEADLESSARRAY(Name, Items) \
|
||||
OT_LABEL_START(Name) \
|
||||
OT_USHORT(OT_COUNT(Name##Data, 2) + 1) \
|
||||
OT_UINT16(OT_COUNT(Name##Data, 2) + 1) \
|
||||
OT_LABEL(Name##Data) \
|
||||
Items \
|
||||
OT_LABEL_END
|
||||
|
@ -111,19 +111,19 @@
|
|||
|
||||
#define OT_LOOKUP(Name, LookupType, LookupFlag, SubLookupOffsets) \
|
||||
OT_LABEL_START(Name) \
|
||||
OT_USHORT(LookupType) \
|
||||
OT_USHORT(LookupFlag) \
|
||||
OT_UINT16(LookupType) \
|
||||
OT_UINT16(LookupFlag) \
|
||||
OT_LABEL_END \
|
||||
OT_UARRAY(Name##SubLookupOffsetsArray, OT_LIST(SubLookupOffsets))
|
||||
|
||||
#define OT_SUBLOOKUP(Name, SubFormat, Items) \
|
||||
OT_LABEL_START(Name) \
|
||||
OT_USHORT(SubFormat) \
|
||||
OT_UINT16(SubFormat) \
|
||||
Items
|
||||
|
||||
#define OT_COVERAGE1(Name, Items) \
|
||||
OT_LABEL_START(Name) \
|
||||
OT_USHORT(1) \
|
||||
OT_UINT16(1) \
|
||||
OT_LABEL_END \
|
||||
OT_UARRAY(Name##Glyphs, OT_LIST(Items))
|
||||
|
||||
|
@ -174,7 +174,7 @@
|
|||
/* Table manifest. */
|
||||
#define MANIFEST(Items) \
|
||||
OT_LABEL_START(manifest) \
|
||||
OT_USHORT(OT_COUNT(manifestData, 6)) \
|
||||
OT_UINT16(OT_COUNT(manifestData, 6)) \
|
||||
OT_LABEL(manifestData) \
|
||||
Items \
|
||||
OT_LABEL_END
|
||||
|
@ -304,8 +304,8 @@ OT_TABLE_END
|
|||
#undef OT_TABLE_END
|
||||
#undef OT_LABEL_START
|
||||
#undef OT_LABEL_END
|
||||
#undef OT_BYTE
|
||||
#undef OT_USHORT
|
||||
#undef OT_UINT8
|
||||
#undef OT_UINT16
|
||||
#undef OT_DISTANCE
|
||||
#undef OT_COUNT
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#define HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH HB_BUFFER_SCRATCH_FLAG_COMPLEX0
|
||||
|
||||
/* See:
|
||||
* https://github.com/behdad/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */
|
||||
* https://github.com/harfbuzz/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */
|
||||
#define HB_ARABIC_GENERAL_CATEGORY_IS_WORD(gen_cat) \
|
||||
(FLAG_UNSAFE (gen_cat) & \
|
||||
(FLAG (HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED) | \
|
||||
|
@ -198,7 +198,7 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
|
|||
* pause for Arabic, not other scripts.
|
||||
*
|
||||
* A pause after calt is required to make KFGQPC Uthmanic Script HAFS
|
||||
* work correctly. See https://github.com/behdad/harfbuzz/issues/505
|
||||
* work correctly. See https://github.com/harfbuzz/harfbuzz/issues/505
|
||||
*/
|
||||
|
||||
map->add_gsub_pause (nuke_joiners);
|
||||
|
|
|
@ -161,7 +161,7 @@ disable_otl_hebrew (const hb_ot_shape_plan_t *plan)
|
|||
* script. This matches Uniscribe better, and makes fonts like
|
||||
* Arial that have GSUB/GPOS/GDEF but no data for Hebrew work.
|
||||
* See:
|
||||
* https://github.com/behdad/harfbuzz/issues/347#issuecomment-267838368
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/347#issuecomment-267838368
|
||||
*/
|
||||
return plan->map.chosen_script[1] != HB_TAG ('h','e','b','r');
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ enum indic_syllabic_category_t {
|
|||
INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_CM,
|
||||
INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA = OT_N,
|
||||
INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER = OT_CS,
|
||||
INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM, /* https://github.com/behdad/harfbuzz/issues/552 */
|
||||
INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM, /* https://github.com/harfbuzz/harfbuzz/issues/552 */
|
||||
INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER = OT_Coeng,
|
||||
INDIC_SYLLABIC_CATEGORY_JOINER = OT_ZWJ,
|
||||
INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X,
|
||||
|
|
|
@ -210,7 +210,7 @@ set_indic_properties (hb_glyph_info_t &info)
|
|||
}
|
||||
else if (unlikely (u == 0x0A51u))
|
||||
{
|
||||
/* https://github.com/behdad/harfbuzz/issues/524 */
|
||||
/* https://github.com/harfbuzz/harfbuzz/issues/524 */
|
||||
cat = OT_M;
|
||||
pos = POS_BELOW_C;
|
||||
}
|
||||
|
@ -220,9 +220,10 @@ set_indic_properties (hb_glyph_info_t &info)
|
|||
else if (unlikely (u == 0x11301u || u == 0x11303u)) cat = OT_SM;
|
||||
else if (unlikely (u == 0x1133cu)) cat = OT_N;
|
||||
|
||||
else if (unlikely (u == 0x0AFBu)) cat = OT_N; /* https://github.com/behdad/harfbuzz/issues/552 */
|
||||
else if (unlikely (u == 0x0AFBu)) cat = OT_N; /* https://github.com/harfbuzz/harfbuzz/issues/552 */
|
||||
|
||||
else if (unlikely (u == 0x0980u)) cat = OT_PLACEHOLDER; /* https://github.com/behdad/harfbuzz/issues/538 */
|
||||
else if (unlikely (u == 0x0980u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/issues/538 */
|
||||
else if (unlikely (u == 0x0C80u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/pull/623 */
|
||||
else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */
|
||||
else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u)))
|
||||
cat = OT_PLACEHOLDER;
|
||||
|
@ -691,7 +692,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
|
|||
const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data;
|
||||
hb_glyph_info_t *info = buffer->info;
|
||||
|
||||
/* https://github.com/behdad/harfbuzz/issues/435#issuecomment-335560167
|
||||
/* https://github.com/harfbuzz/harfbuzz/issues/435#issuecomment-335560167
|
||||
* // For compatibility with legacy usage in Kannada,
|
||||
* // Ra+h+ZWJ must behave like Ra+ZWJ+h...
|
||||
*/
|
||||
|
|
|
@ -90,7 +90,7 @@ CS = 43; # CONS_WITH_STACKER
|
|||
|
||||
|
||||
consonant_modifiers = CMAbv* CMBlw* ((H B | SUB) VS? CMAbv? CMBlw*)*;
|
||||
# Override: Allow two MBlw. https://github.com/behdad/harfbuzz/issues/376
|
||||
# Override: Allow two MBlw. https://github.com/harfbuzz/harfbuzz/issues/376
|
||||
medial_consonants = MPre? MAbv? MBlw?.MBlw? MPst?;
|
||||
dependent_vowels = VPre* VAbv* VBlw* VPst*;
|
||||
vowel_modifiers = VMPre* VMAbv* VMBlw* VMPst*;
|
||||
|
|
|
@ -348,7 +348,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 2070 */ O, O, O, O, FM, O, O, O, O, O, O, O, O, O, O, O,
|
||||
/* 2080 */ O, O, FM, FM, FM, O, O, O,
|
||||
|
||||
#define use_offset_0xa800u 2616
|
||||
#define use_offset_0x20f0u 2616
|
||||
|
||||
|
||||
/* Combining Diacritical Marks for Symbols */
|
||||
|
||||
/* 20F0 */ VMAbv, O, O, O, O, O, O, O,
|
||||
|
||||
#define use_offset_0xa800u 2624
|
||||
|
||||
|
||||
/* Syloti Nagri */
|
||||
|
@ -370,7 +377,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* A880 */ VMPst, VMPst, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
|
||||
/* A890 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
|
||||
/* A8A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
|
||||
/* A8B0 */ B, B, B, B, FPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst,
|
||||
/* A8B0 */ B, B, B, B, MPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst,
|
||||
/* A8C0 */ VPst, VPst, VPst, VPst, H, VMAbv, O, O, O, O, O, O, O, O, O, O,
|
||||
/* A8D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
|
||||
|
||||
|
@ -435,7 +442,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst,
|
||||
/* AAF0 */ O, O, O, O, O, VMPst, H, O,
|
||||
|
||||
#define use_offset_0xabc0u 3376
|
||||
#define use_offset_0xabc0u 3384
|
||||
|
||||
|
||||
/* Meetei Mayek */
|
||||
|
@ -445,14 +452,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O,
|
||||
/* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
|
||||
|
||||
#define use_offset_0xfe00u 3440
|
||||
#define use_offset_0xfe00u 3448
|
||||
|
||||
|
||||
/* Variation Selectors */
|
||||
|
||||
/* FE00 */ VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS,
|
||||
|
||||
#define use_offset_0x10a00u 3456
|
||||
#define use_offset_0x10a00u 3464
|
||||
|
||||
|
||||
/* Kharoshthi */
|
||||
|
@ -463,7 +470,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 10A30 */ B, B, B, B, O, O, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H,
|
||||
/* 10A40 */ B, B, B, B, B, B, B, B,
|
||||
|
||||
#define use_offset_0x11000u 3528
|
||||
#define use_offset_0x11000u 3536
|
||||
|
||||
|
||||
/* Brahmi */
|
||||
|
@ -484,7 +491,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
|
||||
/* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O,
|
||||
|
||||
#define use_offset_0x11100u 3720
|
||||
#define use_offset_0x11100u 3728
|
||||
|
||||
|
||||
/* Chakma */
|
||||
|
@ -522,7 +529,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw,
|
||||
/* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O,
|
||||
|
||||
#define use_offset_0x11280u 4040
|
||||
#define use_offset_0x11280u 4048
|
||||
|
||||
|
||||
/* Multani */
|
||||
|
@ -550,7 +557,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
|
||||
/* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
|
||||
|
||||
#define use_offset_0x11400u 4288
|
||||
#define use_offset_0x11400u 4296
|
||||
|
||||
|
||||
/* Newa */
|
||||
|
@ -573,7 +580,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O,
|
||||
/* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
|
||||
|
||||
#define use_offset_0x11580u 4512
|
||||
#define use_offset_0x11580u 4520
|
||||
|
||||
|
||||
/* Siddham */
|
||||
|
@ -616,7 +623,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O,
|
||||
/* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O,
|
||||
|
||||
#define use_offset_0x11a00u 4960
|
||||
#define use_offset_0x11a00u 4968
|
||||
|
||||
|
||||
/* Zanabazar Square */
|
||||
|
@ -635,7 +642,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 11A80 */ B, B, B, B, O, O, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw,
|
||||
/* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, O, O, O,
|
||||
|
||||
#define use_offset_0x11c00u 5120
|
||||
#define use_offset_0x11c00u 5128
|
||||
|
||||
|
||||
/* Bhaiksuki */
|
||||
|
@ -656,7 +663,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
|
||||
/* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O,
|
||||
|
||||
#define use_offset_0x11d00u 5304
|
||||
#define use_offset_0x11d00u 5312
|
||||
|
||||
|
||||
/* Masaram Gondi */
|
||||
|
@ -668,7 +675,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
|
|||
/* 11D40 */ VMAbv, VMAbv, CMBlw, VAbv, VBlw, H, R, MBlw, O, O, O, O, O, O, O, O,
|
||||
/* 11D50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
|
||||
|
||||
}; /* Table items: 5400; occupancy: 73% */
|
||||
}; /* Table items: 5408; occupancy: 73% */
|
||||
|
||||
USE_TABLE_ELEMENT_TYPE
|
||||
hb_use_get_categories (hb_codepoint_t u)
|
||||
|
@ -694,6 +701,7 @@ hb_use_get_categories (hb_codepoint_t u)
|
|||
case 0x2u:
|
||||
if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u];
|
||||
if (hb_in_range<hb_codepoint_t> (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u];
|
||||
if (hb_in_range<hb_codepoint_t> (u, 0x20F0u, 0x20F7u)) return use_table[u - 0x20F0u + use_offset_0x20f0u];
|
||||
if (unlikely (u == 0x25CCu)) return GB;
|
||||
break;
|
||||
|
||||
|
|
|
@ -218,10 +218,10 @@ position_mark (const hb_ot_shape_plan_t *plan,
|
|||
case HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW:
|
||||
case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE:
|
||||
if (buffer->props.direction == HB_DIRECTION_LTR) {
|
||||
pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing;
|
||||
pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing;
|
||||
break;
|
||||
} else if (buffer->props.direction == HB_DIRECTION_RTL) {
|
||||
pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing;
|
||||
pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing;
|
||||
break;
|
||||
}
|
||||
HB_FALLTHROUGH;
|
||||
|
|
|
@ -108,7 +108,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
|
|||
/* We really want to find a 'vert' feature if there's any in the font, no
|
||||
* matter which script/langsys it is listed (or not) under.
|
||||
* See various bugs referenced from:
|
||||
* https://github.com/behdad/harfbuzz/issues/63 */
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/63 */
|
||||
map->add_feature (HB_TAG ('v','e','r','t'), 1, F_GLOBAL | F_GLOBAL_SEARCH);
|
||||
}
|
||||
|
||||
|
@ -817,11 +817,16 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
|
|||
{
|
||||
c->buffer->deallocate_var_all ();
|
||||
c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
|
||||
if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_EXPANSION_FACTOR)))
|
||||
if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR)))
|
||||
{
|
||||
c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_EXPANSION_FACTOR,
|
||||
c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR,
|
||||
(unsigned) HB_BUFFER_MAX_LEN_MIN);
|
||||
}
|
||||
if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR)))
|
||||
{
|
||||
c->buffer->max_ops = MAX (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR,
|
||||
(unsigned) HB_BUFFER_MAX_OPS_MIN);
|
||||
}
|
||||
|
||||
bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan);
|
||||
//c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face);
|
||||
|
@ -861,6 +866,7 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
|
|||
c->buffer->props.direction = c->target_direction;
|
||||
|
||||
c->buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
|
||||
c->buffer->max_ops = HB_BUFFER_MAX_OPS_DEFAULT;
|
||||
c->buffer->deallocate_var_all ();
|
||||
}
|
||||
|
||||
|
|
|
@ -133,8 +133,8 @@ struct avar
|
|||
protected:
|
||||
FixedVersion<>version; /* Version of the avar table
|
||||
* initially set to 0x00010000u */
|
||||
USHORT reserved; /* This field is permanently reserved. Set to 0. */
|
||||
USHORT axisCount; /* The number of variation axes in the font. This
|
||||
UINT16 reserved; /* This field is permanently reserved. Set to 0. */
|
||||
UINT16 axisCount; /* The number of variation axes in the font. This
|
||||
* must be the same number as axisCount in the
|
||||
* 'fvar' table. */
|
||||
SegmentMaps axisSegmentMapsZ;
|
||||
|
|
|
@ -42,11 +42,11 @@ struct InstanceRecord
|
|||
}
|
||||
|
||||
protected:
|
||||
USHORT subfamilyNameID;/* The name ID for entries in the 'name' table
|
||||
UINT16 subfamilyNameID;/* The name ID for entries in the 'name' table
|
||||
* that provide subfamily names for this instance. */
|
||||
USHORT reserved; /* Reserved for future use — set to 0. */
|
||||
UINT16 reserved; /* Reserved for future use — set to 0. */
|
||||
Fixed coordinates[VAR];/* The coordinates array for this instance. */
|
||||
//USHORT postScriptNameIDX;/*Optional. The name ID for entries in the 'name'
|
||||
//UINT16 postScriptNameIDX;/*Optional. The name ID for entries in the 'name'
|
||||
// * table that provide PostScript names for this
|
||||
// * instance. */
|
||||
|
||||
|
@ -67,8 +67,8 @@ struct AxisRecord
|
|||
Fixed minValue; /* The minimum coordinate value for the axis. */
|
||||
Fixed defaultValue; /* The default coordinate value for the axis. */
|
||||
Fixed maxValue; /* The maximum coordinate value for the axis. */
|
||||
USHORT reserved; /* Reserved for future use — set to 0. */
|
||||
USHORT axisNameID; /* The name ID for entries in the 'name' table that
|
||||
UINT16 reserved; /* Reserved for future use — set to 0. */
|
||||
UINT16 axisNameID; /* The name ID for entries in the 'name' table that
|
||||
* provide a display name for this axis. */
|
||||
|
||||
public:
|
||||
|
@ -186,16 +186,16 @@ struct fvar
|
|||
protected:
|
||||
FixedVersion<>version; /* Version of the fvar table
|
||||
* initially set to 0x00010000u */
|
||||
Offset<> things; /* Offset in bytes from the beginning of the table
|
||||
Offset16 things; /* Offset in bytes from the beginning of the table
|
||||
* to the start of the AxisRecord array. */
|
||||
USHORT reserved; /* This field is permanently reserved. Set to 2. */
|
||||
USHORT axisCount; /* The number of variation axes in the font (the
|
||||
UINT16 reserved; /* This field is permanently reserved. Set to 2. */
|
||||
UINT16 axisCount; /* The number of variation axes in the font (the
|
||||
* number of records in the axes array). */
|
||||
USHORT axisSize; /* The size in bytes of each VariationAxisRecord —
|
||||
UINT16 axisSize; /* The size in bytes of each VariationAxisRecord —
|
||||
* set to 20 (0x0014) for this version. */
|
||||
USHORT instanceCount; /* The number of named instances defined in the font
|
||||
UINT16 instanceCount; /* The number of named instances defined in the font
|
||||
* (the number of records in the instances array). */
|
||||
USHORT instanceSize; /* The size in bytes of each InstanceRecord — set
|
||||
UINT16 instanceSize; /* The size in bytes of each InstanceRecord — set
|
||||
* to either axisCount * sizeof(Fixed) + 4, or to
|
||||
* axisCount * sizeof(Fixed) + 6. */
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ struct DeltaSetIndexMap
|
|||
unsigned int u = 0;
|
||||
{ /* Fetch it. */
|
||||
unsigned int w = get_width ();
|
||||
const BYTE *p = mapData + w * v;
|
||||
const UINT8 *p = mapData + w * v;
|
||||
for (; w; w--)
|
||||
u = (u << 8) + *p++;
|
||||
}
|
||||
|
@ -78,10 +78,10 @@ struct DeltaSetIndexMap
|
|||
{ return (format & 0xF) + 1; }
|
||||
|
||||
protected:
|
||||
USHORT format; /* A packed field that describes the compressed
|
||||
UINT16 format; /* A packed field that describes the compressed
|
||||
* representation of delta-set indices. */
|
||||
USHORT mapCount; /* The number of mapping entries. */
|
||||
BYTE mapData[VAR]; /* The delta-set index mapping data. */
|
||||
UINT16 mapCount; /* The number of mapping entries. */
|
||||
UINT8 mapData[VAR]; /* The delta-set index mapping data. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (4, mapData);
|
||||
|
|
|
@ -43,7 +43,7 @@ struct VariationValueRecord
|
|||
|
||||
public:
|
||||
Tag valueTag; /* Four-byte tag identifying a font-wide measure. */
|
||||
ULONG varIdx; /* Outer/inner index into VariationStore item. */
|
||||
UINT32 varIdx; /* Outer/inner index into VariationStore item. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_STATIC (8);
|
||||
|
@ -95,13 +95,13 @@ protected:
|
|||
protected:
|
||||
FixedVersion<>version; /* Version of the metrics variation table
|
||||
* initially set to 0x00010000u */
|
||||
USHORT reserved; /* Not used; set to 0. */
|
||||
USHORT valueRecordSize;/* The size in bytes of each value record —
|
||||
UINT16 reserved; /* Not used; set to 0. */
|
||||
UINT16 valueRecordSize;/* The size in bytes of each value record —
|
||||
* must be greater than zero. */
|
||||
USHORT valueRecordCount;/* The number of value records — may be zero. */
|
||||
UINT16 valueRecordCount;/* The number of value records — may be zero. */
|
||||
OffsetTo<VariationStore>
|
||||
varStore; /* Offset to item variation store table. */
|
||||
BYTE values[VAR]; /* Array of value records. The records must be
|
||||
UINT8 values[VAR]; /* Array of value records. The records must be
|
||||
* in binary order of their valueTag field. */
|
||||
|
||||
public:
|
||||
|
|
|
@ -692,7 +692,7 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
|
|||
* one enum to another... So this doesn't provide the type-checking that I
|
||||
* originally had in mind... :(.
|
||||
*
|
||||
* For MSVC warnings, see: https://github.com/behdad/harfbuzz/pull/163
|
||||
* For MSVC warnings, see: https://github.com/harfbuzz/harfbuzz/pull/163
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(disable:4200)
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
* hb_set_t
|
||||
*/
|
||||
|
||||
/* TODO Keep a free-list so we can free pages that are completely zeroed. At that
|
||||
* point maybe also use a sentinel value for "all-1" pages? */
|
||||
|
||||
struct hb_set_t
|
||||
{
|
||||
struct page_map_t
|
||||
|
@ -47,9 +50,8 @@ struct hb_set_t
|
|||
|
||||
struct page_t
|
||||
{
|
||||
inline void init (void) {
|
||||
memset (&v, 0, sizeof (v));
|
||||
}
|
||||
inline void init0 (void) { memset (&v, 0, sizeof (v)); }
|
||||
inline void init1 (void) { memset (&v, 0xff, sizeof (v)); }
|
||||
|
||||
inline unsigned int len (void) const
|
||||
{ return ARRAY_LENGTH_CONST (v); }
|
||||
|
@ -66,6 +68,24 @@ struct hb_set_t
|
|||
inline void del (hb_codepoint_t g) { elt (g) &= ~mask (g); }
|
||||
inline bool has (hb_codepoint_t g) const { return !!(elt (g) & mask (g)); }
|
||||
|
||||
inline void add_range (hb_codepoint_t a, hb_codepoint_t b)
|
||||
{
|
||||
elt_t *la = &elt (a);
|
||||
elt_t *lb = &elt (b);
|
||||
if (la == lb)
|
||||
*la |= (mask (b) << 1) - mask(a);
|
||||
else
|
||||
{
|
||||
*la |= ~(mask (a) - 1);
|
||||
la++;
|
||||
|
||||
memset (la, 0xff, (char *) lb - (char *) la);
|
||||
|
||||
*lb |= ((mask (b) << 1) - 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
inline bool is_equal (const page_t *other) const
|
||||
{
|
||||
return 0 == memcmp (&v, &other->v, sizeof (v));
|
||||
|
@ -196,16 +216,37 @@ struct hb_set_t
|
|||
if (unlikely (in_error)) return;
|
||||
if (unlikely (g == INVALID)) return;
|
||||
page_t *page = page_for_insert (g);
|
||||
if (!page)
|
||||
return;
|
||||
if (unlikely (!page)) return;
|
||||
page->add (g);
|
||||
}
|
||||
inline void add_range (hb_codepoint_t a, hb_codepoint_t b)
|
||||
{
|
||||
if (unlikely (in_error)) return;
|
||||
/* TODO Speedup */
|
||||
for (unsigned int i = a; i < b + 1; i++)
|
||||
add (i);
|
||||
if (unlikely (in_error || a > b || a == INVALID || b == INVALID)) return;
|
||||
unsigned int ma = get_major (a);
|
||||
unsigned int mb = get_major (b);
|
||||
if (ma == mb)
|
||||
{
|
||||
page_t *page = page_for_insert (a);
|
||||
if (unlikely (!page)) return;
|
||||
page->add_range (a, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
page_t *page = page_for_insert (a);
|
||||
if (unlikely (!page)) return;
|
||||
page->add_range (a, major_start (ma + 1) - 1);
|
||||
|
||||
for (unsigned int m = ma + 1; m < mb; m++)
|
||||
{
|
||||
page = page_for_insert (major_start (m));
|
||||
if (unlikely (!page)) return;
|
||||
page->init1 ();
|
||||
}
|
||||
|
||||
page = page_for_insert (b);
|
||||
if (unlikely (!page)) return;
|
||||
page->add_range (major_start (mb), b);
|
||||
}
|
||||
}
|
||||
inline void del (hb_codepoint_t g)
|
||||
{
|
||||
|
@ -217,6 +258,7 @@ struct hb_set_t
|
|||
}
|
||||
inline void del_range (hb_codepoint_t a, hb_codepoint_t b)
|
||||
{
|
||||
/* TODO Optimize, like add_range(). */
|
||||
if (unlikely (in_error)) return;
|
||||
for (unsigned int i = a; i < b + 1; i++)
|
||||
del (i);
|
||||
|
@ -433,7 +475,7 @@ struct hb_set_t
|
|||
|
||||
static const hb_codepoint_t INVALID = HB_SET_VALUE_INVALID;
|
||||
|
||||
page_t *page_for_insert (hb_codepoint_t g)
|
||||
inline page_t *page_for_insert (hb_codepoint_t g)
|
||||
{
|
||||
page_map_t map = {get_major (g), pages.len};
|
||||
unsigned int i;
|
||||
|
@ -442,13 +484,13 @@ struct hb_set_t
|
|||
if (!resize (pages.len + 1))
|
||||
return nullptr;
|
||||
|
||||
pages[map.index].init ();
|
||||
pages[map.index].init0 ();
|
||||
memmove (&page_map[i + 1], &page_map[i], (page_map.len - 1 - i) * sizeof (page_map[0]));
|
||||
page_map[i] = map;
|
||||
}
|
||||
return &pages[page_map[i].index];
|
||||
}
|
||||
page_t *page_for (hb_codepoint_t g)
|
||||
inline page_t *page_for (hb_codepoint_t g)
|
||||
{
|
||||
page_map_t key = {get_major (g)};
|
||||
const page_map_t *found = page_map.bsearch (&key);
|
||||
|
@ -456,7 +498,7 @@ struct hb_set_t
|
|||
return &pages[found->index];
|
||||
return nullptr;
|
||||
}
|
||||
const page_t *page_for (hb_codepoint_t g) const
|
||||
inline const page_t *page_for (hb_codepoint_t g) const
|
||||
{
|
||||
page_map_t key = {get_major (g)};
|
||||
const page_map_t *found = page_map.bsearch (&key);
|
||||
|
@ -464,9 +506,10 @@ struct hb_set_t
|
|||
return &pages[found->index];
|
||||
return nullptr;
|
||||
}
|
||||
page_t &page_at (unsigned int i) { return pages[page_map[i].index]; }
|
||||
const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
|
||||
unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
|
||||
inline page_t &page_at (unsigned int i) { return pages[page_map[i].index]; }
|
||||
inline const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
|
||||
inline unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
|
||||
inline hb_codepoint_t major_start (unsigned int major) const { return major * page_t::PAGE_BITS; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static const union HB_STRING_ARRAY_TYPE_NAME {
|
|||
#include HB_STRING_ARRAY_LIST
|
||||
#undef _S
|
||||
} st;
|
||||
char str[0];
|
||||
char str[VAR];
|
||||
}
|
||||
HB_STRING_ARRAY_POOL_NAME =
|
||||
{
|
||||
|
|
|
@ -137,7 +137,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
|
|||
* we do NOT want to hide them, as the way Uniscribe has implemented them
|
||||
* is with regular spacing glyphs, and that's the way fonts are made to work.
|
||||
* As such, we make exceptions for those four.
|
||||
* Also ignoring U+1BCA0..1BCA3. https://github.com/behdad/harfbuzz/issues/503
|
||||
* Also ignoring U+1BCA0..1BCA3. https://github.com/harfbuzz/harfbuzz/issues/503
|
||||
*
|
||||
* Unicode 7.0:
|
||||
* $ grep '; Default_Ignorable_Code_Point ' DerivedCoreProperties.txt | sed 's/;.*#/#/'
|
||||
|
|
|
@ -38,9 +38,9 @@ HB_BEGIN_DECLS
|
|||
|
||||
#define HB_VERSION_MAJOR 1
|
||||
#define HB_VERSION_MINOR 7
|
||||
#define HB_VERSION_MICRO 1
|
||||
#define HB_VERSION_MICRO 2
|
||||
|
||||
#define HB_VERSION_STRING "1.7.1"
|
||||
#define HB_VERSION_STRING "1.7.2"
|
||||
|
||||
#define HB_VERSION_ATLEAST(major,minor,micro) \
|
||||
((major)*10000+(minor)*100+(micro) <= \
|
||||
|
|
|
@ -106,8 +106,8 @@ main (int argc, char **argv)
|
|||
|
||||
switch (table.tag) {
|
||||
|
||||
case GSUBGPOS::GSUBTag:
|
||||
case GSUBGPOS::GPOSTag:
|
||||
case HB_OT_TAG_GSUB:
|
||||
case HB_OT_TAG_GPOS:
|
||||
{
|
||||
|
||||
const GSUBGPOS &g = *CastP<GSUBGPOS> (font_data + table.offset);
|
||||
|
|
|
@ -45,7 +45,7 @@ hb.buffer_set_message_func (buf, debugger.message, 1, 0)
|
|||
## Add text to buffer
|
||||
##
|
||||
#
|
||||
# See https://github.com/behdad/harfbuzz/pull/271
|
||||
# See https://github.com/harfbuzz/harfbuzz/pull/271
|
||||
#
|
||||
if False:
|
||||
# If you do not care about cluster values reflecting Python
|
||||
|
|
|
@ -155,10 +155,6 @@ class JSAPITest
|
|||
return jsvalToSource(val);
|
||||
}
|
||||
|
||||
JSAPITestString toSource(JSVersion v) {
|
||||
return JSAPITestString(JS_VersionToString(v));
|
||||
}
|
||||
|
||||
// Note that in some still-supported GCC versions (we think anything before
|
||||
// GCC 4.6), this template does not work when the second argument is
|
||||
// nullptr. It infers type U = long int. Use CHECK_NULL instead.
|
||||
|
|
|
@ -594,47 +594,6 @@ JS::SetSingleThreadedExecutionCallbacks(JSContext* cx,
|
|||
cx->runtime()->endSingleThreadedExecutionCallback = end;
|
||||
}
|
||||
|
||||
static const struct v2smap {
|
||||
JSVersion version;
|
||||
const char* string;
|
||||
} v2smap[] = {
|
||||
{JSVERSION_ECMA_3, "ECMAv3"},
|
||||
{JSVERSION_1_6, "1.6"},
|
||||
{JSVERSION_1_7, "1.7"},
|
||||
{JSVERSION_1_8, "1.8"},
|
||||
{JSVERSION_ECMA_5, "ECMAv5"},
|
||||
{JSVERSION_DEFAULT, js_default_str},
|
||||
{JSVERSION_DEFAULT, "1.0"},
|
||||
{JSVERSION_DEFAULT, "1.1"},
|
||||
{JSVERSION_DEFAULT, "1.2"},
|
||||
{JSVERSION_DEFAULT, "1.3"},
|
||||
{JSVERSION_DEFAULT, "1.4"},
|
||||
{JSVERSION_DEFAULT, "1.5"},
|
||||
{JSVERSION_UNKNOWN, nullptr}, /* must be last, nullptr is sentinel */
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(const char*)
|
||||
JS_VersionToString(JSVersion version)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; v2smap[i].string; i++)
|
||||
if (v2smap[i].version == version)
|
||||
return v2smap[i].string;
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSVersion)
|
||||
JS_StringToVersion(const char* string)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; v2smap[i].string; i++)
|
||||
if (strcmp(v2smap[i].string, string) == 0)
|
||||
return v2smap[i].version;
|
||||
return JSVERSION_UNKNOWN;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JS::ContextOptions&)
|
||||
JS::ContextOptionsRef(JSContext* cx)
|
||||
{
|
||||
|
|
|
@ -1076,12 +1076,6 @@ class MOZ_RAII JSAutoRequest
|
|||
#endif
|
||||
};
|
||||
|
||||
extern JS_PUBLIC_API(const char*)
|
||||
JS_VersionToString(JSVersion version);
|
||||
|
||||
extern JS_PUBLIC_API(JSVersion)
|
||||
JS_StringToVersion(const char* string);
|
||||
|
||||
namespace JS {
|
||||
|
||||
class JS_PUBLIC_API(ContextOptions) {
|
||||
|
|
|
@ -46,22 +46,6 @@ struct Zone;
|
|||
|
||||
} // namespace JS
|
||||
|
||||
/*
|
||||
* Run-time version enumeration. For compile-time version checking, please use
|
||||
* the JS_HAS_* macros in jsversion.h, or use MOZJS_MAJOR_VERSION,
|
||||
* MOZJS_MINOR_VERSION, MOZJS_PATCH_VERSION, and MOZJS_ALPHA definitions.
|
||||
*/
|
||||
enum JSVersion {
|
||||
JSVERSION_ECMA_3 = 148,
|
||||
JSVERSION_1_6 = 160,
|
||||
JSVERSION_1_7 = 170,
|
||||
JSVERSION_1_8 = 180,
|
||||
JSVERSION_ECMA_5 = 185,
|
||||
JSVERSION_DEFAULT = 0,
|
||||
JSVERSION_UNKNOWN = -1,
|
||||
JSVERSION_LATEST = JSVERSION_ECMA_5
|
||||
};
|
||||
|
||||
/* Result of typeof operator enumeration. */
|
||||
enum JSType {
|
||||
JSTYPE_UNDEFINED, /* undefined */
|
||||
|
|
|
@ -139,7 +139,6 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
|
|||
numCompartments(0),
|
||||
localeCallbacks(nullptr),
|
||||
defaultLocale(nullptr),
|
||||
defaultVersion_(JSVERSION_DEFAULT),
|
||||
profilingScripts(false),
|
||||
scriptAndCountsVector(nullptr),
|
||||
lcovOutput_(),
|
||||
|
|
|
@ -642,9 +642,6 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
|
|||
/* Default locale for Internationalization API */
|
||||
js::ActiveThreadData<char*> defaultLocale;
|
||||
|
||||
/* Default JSVersion. */
|
||||
js::ActiveThreadData<JSVersion> defaultVersion_;
|
||||
|
||||
/* If true, new scripts must be created with PC counter information. */
|
||||
js::ActiveThreadOrIonCompileData<bool> profilingScripts;
|
||||
|
||||
|
@ -741,9 +738,6 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
|
|||
/* Gets current default locale. String remains owned by context. */
|
||||
const char* getDefaultLocale();
|
||||
|
||||
JSVersion defaultVersion() const { return defaultVersion_; }
|
||||
void setDefaultVersion(JSVersion v) { defaultVersion_ = v; }
|
||||
|
||||
/* Garbage collector state, used by jsgc.c. */
|
||||
js::gc::GCRuntime gc;
|
||||
|
||||
|
|
|
@ -1843,7 +1843,7 @@ nsXPCComponents_utils_Sandbox::CallOrConstruct(nsIXPConnectWrappedNative* wrappe
|
|||
nsresult
|
||||
xpc::EvalInSandbox(JSContext* cx, HandleObject sandboxArg, const nsAString& source,
|
||||
const nsACString& filename, int32_t lineNo,
|
||||
JSVersion jsVersion, MutableHandleValue rval)
|
||||
MutableHandleValue rval)
|
||||
{
|
||||
JS_AbortIfWrongThread(cx);
|
||||
rval.set(UndefinedValue());
|
||||
|
|
|
@ -2211,24 +2211,7 @@ nsXPCComponents_Utils::EvalInSandbox(const nsAString& source,
|
|||
if (!JS_ValueToObject(cx, sandboxVal, &sandbox) || !sandbox)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Optional third argument: JS version, as a string.
|
||||
JSVersion jsVersion = JSVERSION_DEFAULT;
|
||||
if (optionalArgc >= 1) {
|
||||
JSString* jsVersionStr = ToString(cx, version);
|
||||
if (!jsVersionStr)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
JSAutoByteString bytes(cx, jsVersionStr);
|
||||
if (!bytes)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
// Treat non-default version designation as default.
|
||||
if (JS_StringToVersion(bytes.ptr()) == JSVERSION_UNKNOWN &&
|
||||
strcmp(bytes.ptr(), "latest"))
|
||||
{
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
// Optional third argument: JS version, as a string, is unused.
|
||||
|
||||
// Optional fourth and fifth arguments: filename and line number.
|
||||
int32_t lineNo = (optionalArgc >= 3) ? lineNumber : 1;
|
||||
|
@ -2246,8 +2229,7 @@ nsXPCComponents_Utils::EvalInSandbox(const nsAString& source,
|
|||
}
|
||||
}
|
||||
|
||||
return xpc::EvalInSandbox(cx, sandbox, source, filename, lineNo,
|
||||
jsVersion, retval);
|
||||
return xpc::EvalInSandbox(cx, sandbox, source, filename, lineNo, retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -798,8 +798,7 @@ nsXPConnect::EvalInSandboxObject(const nsAString& source, const char* filename,
|
|||
} else {
|
||||
filenameStr = NS_LITERAL_CSTRING("x-bogus://XPConnect/Sandbox");
|
||||
}
|
||||
return EvalInSandbox(cx, sandbox, source, filenameStr, 1,
|
||||
JSVERSION_DEFAULT, rval);
|
||||
return EvalInSandbox(cx, sandbox, source, filenameStr, 1, rval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -2916,7 +2916,7 @@ CreateSandboxObject(JSContext* cx, JS::MutableHandleValue vp, nsISupports* prinO
|
|||
nsresult
|
||||
EvalInSandbox(JSContext* cx, JS::HandleObject sandbox, const nsAString& source,
|
||||
const nsACString& filename, int32_t lineNo,
|
||||
JSVersion jsVersion, JS::MutableHandleValue rval);
|
||||
JS::MutableHandleValue rval);
|
||||
|
||||
nsresult
|
||||
GetSandboxAddonId(JSContext* cx, JS::HandleObject sandboxArg,
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<html>
|
||||
<head>
|
||||
<style>
|
||||
* {
|
||||
background: url(16.png), url(16.png) transparent;
|
||||
-webkit-background-clip: text, text;
|
||||
-moz-tab-size: calc(1 + 1) !important;
|
||||
background-blend-mode: screen;
|
||||
align-content: baseline;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function fun_0() {
|
||||
try { o3 = document.createElement('th') } catch (e) {};
|
||||
try { o1.appendChild(o3) } catch (e) {}
|
||||
}
|
||||
|
||||
try { o1 = document.createElement('tr') } catch (e) {}
|
||||
try { o2 = document.createElement('ol') } catch (e) {}
|
||||
try { xhr = new XMLHttpRequest({mozAnon: false }) } catch (e) {}
|
||||
try { document.documentElement.appendChild(o1) } catch (e) {}
|
||||
try { document.documentElement.appendChild(o2) } catch (e) {}
|
||||
for (let i = 0; i < 100; i++) {
|
||||
try { xhr.open('GET', 'data:text/html,1', false); } catch (e) {};
|
||||
try { xhr.send(); } catch (e) {};
|
||||
try { fuzzPriv.GC(); fuzzPriv.CC(); fuzzPriv.GC(); fuzzPriv.CC(); } catch (e) {};
|
||||
try { xhr.addEventListener('readystatechange', fun_0, true) } catch (e) {};
|
||||
try { o2.offsetLeft } catch (e) {};
|
||||
try { document.styleSheets[0].cssRules[0].style['background-origin'] = 'border-box, border-box' } catch (e) {}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
</html>
|
|
@ -3,5 +3,6 @@ skip-if(!(stylo||styloVsGecko)||Android) load 1407470-1.html
|
|||
load 1413073-1.html
|
||||
load 1413073-2.html
|
||||
load 1405881-1.html
|
||||
load 1418177-1.html
|
||||
load 1418722-1.html
|
||||
load 1419917.html
|
||||
|
|
|
@ -3774,19 +3774,32 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||
// asr is scrolled. Even if we wrap a fixed background layer, that's
|
||||
// fine, because the item will have a scrolled clip that limits the
|
||||
// item with respect to asr.
|
||||
if (aSecondaryReferenceFrame) {
|
||||
thisItemList.AppendNewToTop(
|
||||
new (aBuilder) nsDisplayTableBlendMode(aBuilder, aSecondaryReferenceFrame, &thisItemList,
|
||||
bg->mImage.mLayers[i].mBlendMode,
|
||||
asr, i + 1, aFrame));
|
||||
} else {
|
||||
thisItemList.AppendNewToTop(
|
||||
new (aBuilder) nsDisplayBlendMode(aBuilder, aFrame, &thisItemList,
|
||||
bg->mImage.mLayers[i].mBlendMode,
|
||||
asr, i + 1));
|
||||
}
|
||||
}
|
||||
bgItemList.AppendToTop(&thisItemList);
|
||||
}
|
||||
|
||||
if (needBlendContainer) {
|
||||
DisplayListClipState::AutoSaveRestore blendContainerClip(aBuilder);
|
||||
if (aSecondaryReferenceFrame) {
|
||||
bgItemList.AppendNewToTop(
|
||||
nsDisplayTableBlendContainer::CreateForBackgroundBlendMode(aBuilder, aSecondaryReferenceFrame,
|
||||
&bgItemList, asr, aFrame));
|
||||
} else {
|
||||
bgItemList.AppendNewToTop(
|
||||
nsDisplayBlendContainer::CreateForBackgroundBlendMode(aBuilder, aFrame, &bgItemList, asr));
|
||||
}
|
||||
}
|
||||
|
||||
aList->AppendToTop(&bgItemList);
|
||||
return false;
|
||||
|
@ -6941,6 +6954,15 @@ nsDisplayBlendContainer::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
|
|||
aManager, aDisplayListBuilder);
|
||||
}
|
||||
|
||||
/* static */ nsDisplayTableBlendContainer*
|
||||
nsDisplayTableBlendContainer::CreateForBackgroundBlendMode(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, nsDisplayList* aList,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
nsIFrame* aAncestorFrame)
|
||||
{
|
||||
return new (aBuilder) nsDisplayTableBlendContainer(aBuilder, aFrame, aList, aActiveScrolledRoot, true, aAncestorFrame);
|
||||
}
|
||||
|
||||
nsDisplayOwnLayer::nsDisplayOwnLayer(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame, nsDisplayList* aList,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
|
|
|
@ -5014,11 +5014,38 @@ public:
|
|||
|
||||
NS_DISPLAY_DECL_NAME("BlendMode", TYPE_BLEND_MODE)
|
||||
|
||||
private:
|
||||
protected:
|
||||
uint8_t mBlendMode;
|
||||
uint32_t mIndex;
|
||||
};
|
||||
|
||||
class nsDisplayTableBlendMode : public nsDisplayBlendMode
|
||||
{
|
||||
public:
|
||||
nsDisplayTableBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
nsDisplayList* aList, uint8_t aBlendMode,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
uint32_t aIndex, nsIFrame* aAncestorFrame)
|
||||
: nsDisplayBlendMode(aBuilder, aFrame, aList, aBlendMode, aActiveScrolledRoot, aIndex)
|
||||
, mAncestorFrame(aAncestorFrame)
|
||||
, mTableType(GetTableTypeFromFrame(aAncestorFrame))
|
||||
{ }
|
||||
|
||||
virtual nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
|
||||
|
||||
virtual uint32_t GetPerFrameKey() const override {
|
||||
return (mIndex << (TYPE_BITS + static_cast<uint8_t>(TableTypeBits::COUNT))) |
|
||||
(static_cast<uint8_t>(mTableType) << TYPE_BITS) |
|
||||
nsDisplayItem::GetPerFrameKey();
|
||||
}
|
||||
|
||||
NS_DISPLAY_DECL_NAME("BlendMode", TYPE_BLEND_MODE)
|
||||
|
||||
protected:
|
||||
nsIFrame* mAncestorFrame;
|
||||
TableType mTableType;
|
||||
};
|
||||
|
||||
class nsDisplayBlendContainer : public nsDisplayWrapList {
|
||||
public:
|
||||
static nsDisplayBlendContainer*
|
||||
|
@ -5070,7 +5097,7 @@ public:
|
|||
}
|
||||
NS_DISPLAY_DECL_NAME("BlendContainer", TYPE_BLEND_CONTAINER)
|
||||
|
||||
private:
|
||||
protected:
|
||||
nsDisplayBlendContainer(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
|
@ -5086,6 +5113,38 @@ private:
|
|||
bool mIsForBackground;
|
||||
};
|
||||
|
||||
class nsDisplayTableBlendContainer : public nsDisplayBlendContainer
|
||||
{
|
||||
public:
|
||||
static nsDisplayTableBlendContainer*
|
||||
CreateForBackgroundBlendMode(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
nsIFrame* aAncestorFrame);
|
||||
virtual nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
|
||||
|
||||
virtual uint32_t GetPerFrameKey() const override {
|
||||
return (static_cast<uint8_t>(mTableType) << TYPE_BITS) |
|
||||
nsDisplayItem::GetPerFrameKey();
|
||||
}
|
||||
|
||||
NS_DISPLAY_DECL_NAME("BlendContainer", TYPE_BLEND_CONTAINER)
|
||||
|
||||
protected:
|
||||
nsDisplayTableBlendContainer(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
nsDisplayList* aList,
|
||||
const ActiveScrolledRoot* aActiveScrolledRoot,
|
||||
bool aIsForBackground, nsIFrame* aAncestorFrame)
|
||||
: nsDisplayBlendContainer(aBuilder, aFrame, aList, aActiveScrolledRoot, aIsForBackground)
|
||||
, mAncestorFrame(aAncestorFrame)
|
||||
, mTableType(GetTableTypeFromFrame(aAncestorFrame))
|
||||
{ }
|
||||
|
||||
nsIFrame* mAncestorFrame;
|
||||
TableType mTableType;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* nsDisplayOwnLayer constructor flags. If we nest this class inside
|
||||
* nsDisplayOwnLayer then we can't forward-declare it up at the top of this
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Bug 1405929 reftest reference</title>
|
||||
<style>
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
display: inline-table;
|
||||
vertical-align: top;
|
||||
margin: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
td {
|
||||
background: green border-box;
|
||||
padding: 20px;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.bb {
|
||||
border-bottom: 5px dashed fuchsia;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<tr>
|
||||
<td colspan="2" class=bb>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE HTML>
|
||||
<title>Bug 1405929 reftest</title>
|
||||
<style>
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
display: inline-table;
|
||||
vertical-align: top;
|
||||
margin: 20px;
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
td {
|
||||
background: green border-box;
|
||||
padding: 20px;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.bb {
|
||||
border-bottom: 5px dashed fuchsia;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<td rowspan="2" class=bb>
|
||||
<tr>
|
||||
<td class=bb>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Bug 1405929 reftest reference</title>
|
||||
<style type="text/css">
|
||||
table { border-collapse: collapse; }
|
||||
td { padding-left: 1em; }
|
||||
td:first-child {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
.x {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr> <td>1 </td> <td class="x" rowspan="2">Spans 1-2</td> </tr>
|
||||
<tr> <td>2 </td> </tr>
|
||||
<tr> <td>3 </td> <td class="x" rowspan="3">Spans 3-5</td> </tr>
|
||||
<tr> <td>4 </td> </tr>
|
||||
<tr> <td>5 </td> </tr>
|
||||
<tr> <td>6 </td> <td class="x">Nospan</td> </tr>
|
||||
<tr> <td>7 </td> <td class="x" rowspan="2">Spans 7-8</td> </tr>
|
||||
<tr> <td>8 </td> </tr>
|
||||
<tr> <td>9 </td> <td></td> </tr>
|
||||
<tr> <td>10</td> <td class="x"></td> </tr>
|
||||
<tr> <td>11</td> <td class="x" rowspan="4">Spans 11-14</td> </tr>
|
||||
<tr> <td>12</td> </tr>
|
||||
<tr> <td>13</td> </tr>
|
||||
<tr> <td>14</td> </tr>
|
||||
<tr> <td>13</td> <td class="x">Nospan</td> </tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<title>Bug 1405929 reftest</title>
|
||||
<style type="text/css">
|
||||
table { border-collapse: collapse; }
|
||||
tr { border-bottom: 1px solid black; }
|
||||
td { padding-left: 1em; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr> <td>1 </td> <td rowspan="2">Spans 1-2 </td> </tr>
|
||||
<tr> <td>2 </td> </tr>
|
||||
<tr> <td>3 </td> <td rowspan="3">Spans 3-5 </td> </tr>
|
||||
<tr> <td>4 </td> </tr>
|
||||
<tr> <td>5 </td> </tr>
|
||||
<tr> <td>6 </td> <td> Nospan </td> </tr>
|
||||
<tr> <td>7 </td> <td rowspan="2">Spans 7-8 </td> </tr>
|
||||
<tr> <td>8 </td> </tr>
|
||||
<tr> <td>9 </td> <td rowspan="2"></td> </tr>
|
||||
<tr> <td>10</td> </tr>
|
||||
<tr> <td>11</td> <td rowspan="4">Spans 11-14</td> </tr>
|
||||
<tr> <td>12</td> </tr>
|
||||
<tr> <td>13</td> </tr>
|
||||
<tr> <td>14</td> </tr>
|
||||
<tr> <td>13</td> <td> Nospan </td> </tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
== bug1379306.html bug1379306-ref.html
|
||||
== bug1394226.html bug1394226-ref.html
|
||||
!= bug1394226.html bug1394226-notref.html
|
||||
== bug1405929.html bug1405929-ref.html
|
||||
== bug1405929-2.html bug1405929-2-ref.html
|
||||
== bc_dyn_cell1.html bc_dyn_cell1_ref.html
|
||||
== bc_dyn_cell2.html bc_dyn_cell2_ref.html
|
||||
== bc_dyn_cell3.html bc_dyn_cell3_ref.html
|
||||
|
|
|
@ -6453,12 +6453,14 @@ nsTableFrame::CalcBCBorders()
|
|||
gotRowBorder = true;
|
||||
}
|
||||
}
|
||||
|
||||
// see if the cell to the iEnd side had a rowspan and its bEnd-iStart border
|
||||
// needs be joined with this one's bEnd
|
||||
// if there is a cell to the iEnd and the cell to iEnd side was a rowspan
|
||||
if ((info.mNumTableCols != info.GetCellEndColIndex() + 1) &&
|
||||
(lastBEndBorders[info.GetCellEndColIndex() + 1].rowSpan > 1)) {
|
||||
// In the function, we try to join two cells' BEnd.
|
||||
// We normally do this work when processing the cell on the iEnd side,
|
||||
// but when the cell on the iEnd side has a rowspan, the cell on the
|
||||
// iStart side gets processed later (now), so we have to do this work now.
|
||||
const auto nextColIndex = info.GetCellEndColIndex() + 1;
|
||||
if ((info.mNumTableCols != nextColIndex) &&
|
||||
(lastBEndBorders[nextColIndex].rowSpan > 1) &&
|
||||
(lastBEndBorders[nextColIndex].rowIndex == info.GetCellEndRowIndex() + 1)) {
|
||||
BCCornerInfo& corner = bEndCorners[info.GetCellEndColIndex() + 1];
|
||||
if (!IsBlock(LogicalSide(corner.ownerSide))) {
|
||||
// not a block-dir owner
|
||||
|
|
|
@ -260,6 +260,9 @@ static const DllBlockInfo sWindowsDllBlocklist[] = {
|
|||
// Avecto Privilege Guard causes crashes, bug 1385542
|
||||
{ "pghook.dll", ALL_VERSIONS },
|
||||
|
||||
// Old versions of G DATA BankGuard, bug 1421991
|
||||
{ "banksafe64.dll", MAKE_VERSION(1, 2, 15299, 65535) },
|
||||
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -4118,6 +4118,13 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, nsIApplicationCache* appC
|
|||
|
||||
// Ignore !(size > 0) from the resumability condition
|
||||
if (!IsResumable(size, contentLength, true)) {
|
||||
if (IsNavigation()) {
|
||||
LOG((" bypassing wait for the entry, "
|
||||
"this is a navigational load"));
|
||||
*aResult = ENTRY_NOT_WANTED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
LOG((" wait for entry completion, "
|
||||
"response is not resumable"));
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@ import buildconfig
|
|||
def main(argv):
|
||||
parser = argparse.ArgumentParser('Generate a file from a Python script',
|
||||
add_help=False)
|
||||
parser.add_argument('--locale', metavar='locale', type=str,
|
||||
help='The locale in use.')
|
||||
parser.add_argument('python_script', metavar='python-script', type=str,
|
||||
help='The Python script to run')
|
||||
parser.add_argument('method_name', metavar='method-name', type=str,
|
||||
|
@ -37,6 +39,9 @@ def main(argv):
|
|||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
kwargs = {}
|
||||
if args.locale:
|
||||
kwargs['locale'] = args.locale
|
||||
script = args.python_script
|
||||
# Permit the script to import modules from the same directory in which it
|
||||
# resides. The justification for doing this is that if we were invoking
|
||||
|
@ -59,8 +64,8 @@ def main(argv):
|
|||
|
||||
ret = 1
|
||||
try:
|
||||
with FileAvoidWrite(args.output_file) as output:
|
||||
ret = module.__dict__[method](output, *args.additional_arguments)
|
||||
with FileAvoidWrite(args.output_file, mode='rb') as output:
|
||||
ret = module.__dict__[method](output, *args.additional_arguments, **kwargs)
|
||||
# The following values indicate a statement of success:
|
||||
# - a set() (see below)
|
||||
# - 0
|
||||
|
|
|
@ -520,16 +520,38 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
self._process_defines(obj, backend_file)
|
||||
|
||||
elif isinstance(obj, GeneratedFile):
|
||||
tier = 'export' if obj.required_for_compile else 'misc'
|
||||
if obj.required_for_compile:
|
||||
tier = 'export'
|
||||
elif obj.localized:
|
||||
tier = 'libs'
|
||||
else:
|
||||
tier = 'misc'
|
||||
self._no_skip[tier].add(backend_file.relobjdir)
|
||||
first_output = obj.outputs[0]
|
||||
dep_file = "%s.pp" % first_output
|
||||
|
||||
if obj.inputs:
|
||||
if obj.localized:
|
||||
# Localized generated files can have locale-specific inputs, which are
|
||||
# indicated by paths starting with `en-US/`.
|
||||
def srcpath(p):
|
||||
bits = p.split('en-US/', 1)
|
||||
if len(bits) == 2:
|
||||
e, f = bits
|
||||
assert(not e)
|
||||
return '$(call MERGE_FILE,%s)' % f
|
||||
return self._pretty_path(p, backend_file)
|
||||
inputs = [srcpath(f) for f in obj.inputs]
|
||||
else:
|
||||
inputs = [self._pretty_path(f, backend_file) for f in obj.inputs]
|
||||
else:
|
||||
inputs = []
|
||||
|
||||
# If we're doing this during export that means we need it during
|
||||
# compile, but if we have an artifact build we don't run compile,
|
||||
# so we can skip it altogether or let the rule run as the result of
|
||||
# something depending on it.
|
||||
if tier == 'misc' or not self.environment.is_artifact_build:
|
||||
if tier != 'export' or not self.environment.is_artifact_build:
|
||||
backend_file.write('%s:: %s\n' % (tier, first_output))
|
||||
for output in obj.outputs:
|
||||
if output != first_output:
|
||||
|
@ -537,15 +559,21 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
backend_file.write('GARBAGE += %s\n' % output)
|
||||
backend_file.write('EXTRA_MDDEPEND_FILES += %s\n' % dep_file)
|
||||
if obj.script:
|
||||
backend_file.write("""{output}: {script}{inputs}{backend}
|
||||
backend_file.write("""{output}: {script}{inputs}{backend}{repack_force}
|
||||
\t$(REPORT_BUILD)
|
||||
\t$(call py_action,file_generate,{script} {method} {output} $(MDDEPDIR)/{dep_file}{inputs}{flags})
|
||||
\t$(call py_action,file_generate,{locale}{script} {method} {output} $(MDDEPDIR)/{dep_file}{inputs}{flags})
|
||||
|
||||
""".format(output=first_output,
|
||||
dep_file=dep_file,
|
||||
inputs=' ' + ' '.join([self._pretty_path(f, backend_file) for f in obj.inputs]) if obj.inputs else '',
|
||||
inputs=' ' + ' '.join(inputs) if inputs else '',
|
||||
flags=' ' + ' '.join(shell_quote(f) for f in obj.flags) if obj.flags else '',
|
||||
backend=' backend.mk' if obj.flags else '',
|
||||
# Locale repacks repack multiple locales from a single configured objdir,
|
||||
# so standard mtime dependencies won't work properly when the build is re-run
|
||||
# with a different locale as input. IS_LANGUAGE_REPACK will reliably be set
|
||||
# in this situation, so simply force the generation to run in that case.
|
||||
repack_force=' $(if $(IS_LANGUAGE_REPACK),FORCE)' if obj.localized else '',
|
||||
locale='--locale=$(AB_CD) ' if obj.localized else '',
|
||||
script=obj.script,
|
||||
method=obj.method))
|
||||
|
||||
|
@ -1454,7 +1482,8 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
|
||||
def _write_localized_files_files(self, files, name, backend_file):
|
||||
for f in files:
|
||||
# The emitter asserts that all files start with `en-US/`
|
||||
if not isinstance(f, ObjDirPath):
|
||||
# The emitter asserts that all srcdir files start with `en-US/`
|
||||
e, f = f.split('en-US/')
|
||||
assert(not e)
|
||||
if '*' in f:
|
||||
|
@ -1465,6 +1494,9 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
backend_file.write('%s += $(wildcard $(LOCALE_SRCDIR)/%s)\n' % (name, f))
|
||||
else:
|
||||
backend_file.write('%s += $(call MERGE_FILE,%s)\n' % (name, f))
|
||||
else:
|
||||
# Objdir files are allowed from LOCALIZED_GENERATED_FILES
|
||||
backend_file.write('%s += %s\n' % (name, self._pretty_path(f, backend_file)))
|
||||
|
||||
def _process_localized_files(self, obj, files, backend_file):
|
||||
target = obj.install_target
|
||||
|
|
|
@ -910,6 +910,11 @@ SchedulingComponents = ContextDerivedTypedRecord(
|
|||
('inclusive', TypedList(unicode, StrictOrderingOnAppendList)),
|
||||
('exclusive', TypedList(unicode, StrictOrderingOnAppendList)))
|
||||
|
||||
GeneratedFilesList = StrictOrderingOnAppendListWithFlagsFactory({
|
||||
'script': unicode,
|
||||
'inputs': list,
|
||||
'flags': list, })
|
||||
|
||||
|
||||
class Files(SubContext):
|
||||
"""Metadata attached to files.
|
||||
|
@ -1291,10 +1296,7 @@ VARIABLES = {
|
|||
size.
|
||||
"""),
|
||||
|
||||
'GENERATED_FILES': (StrictOrderingOnAppendListWithFlagsFactory({
|
||||
'script': unicode,
|
||||
'inputs': list,
|
||||
'flags': list, }), list,
|
||||
'GENERATED_FILES': (GeneratedFilesList, list,
|
||||
"""Generic generated files.
|
||||
|
||||
This variable contains a list of files for the build system to
|
||||
|
@ -1439,10 +1441,12 @@ VARIABLES = {
|
|||
* ``$LOCALE_SRCDIR`` with the leading ``en-US`` removed
|
||||
* the in-tree en-US location
|
||||
|
||||
Paths specified here must be relative to the source directory and must
|
||||
include a leading ``en-US``. Wildcards are allowed, and will be
|
||||
expanded at the time of locale packaging to match files in the
|
||||
locale directory.
|
||||
Source directory paths specified here must must include a leading ``en-US``.
|
||||
Wildcards are allowed, and will be expanded at the time of locale packaging to match
|
||||
files in the locale directory.
|
||||
|
||||
Object directory paths are allowed here only if the path matches an entry in
|
||||
``LOCALIZED_GENERATED_FILES``.
|
||||
|
||||
Files that are missing from a locale will typically have the en-US
|
||||
version used, but for wildcard expansions only files from the
|
||||
|
@ -1471,6 +1475,23 @@ VARIABLES = {
|
|||
locale being packaged, as with preprocessed entries in jar manifests.
|
||||
"""),
|
||||
|
||||
'LOCALIZED_GENERATED_FILES': (GeneratedFilesList, list,
|
||||
"""Like ``GENERATED_FILES``, but for files whose content varies based on the locale in use.
|
||||
|
||||
For simple cases of text substitution, prefer ``LOCALIZED_PP_FILES``.
|
||||
|
||||
Refer to the documentation of ``GENERATED_FILES``; for the most part things work the same.
|
||||
The two major differences are:
|
||||
1. The function in the Python script will be passed an additional keyword argument `locale`
|
||||
which provides the locale in use, i.e. ``en-US``.
|
||||
2. The ``inputs`` list may contain paths to files that will be taken from the locale
|
||||
source directory (see ``LOCALIZED_FILES`` for a discussion of the specifics). Paths
|
||||
in ``inputs`` starting with ``en-US/`` are considered localized files.
|
||||
|
||||
To place the generated output file in a specific location, list its objdir path in
|
||||
``LOCALIZED_FILES``.
|
||||
"""),
|
||||
|
||||
'OBJDIR_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list,
|
||||
"""List of files to be installed anywhere in the objdir. Use sparingly.
|
||||
|
||||
|
|
|
@ -1069,15 +1069,17 @@ class GeneratedFile(ContextDerived):
|
|||
'inputs',
|
||||
'flags',
|
||||
'required_for_compile',
|
||||
'localized',
|
||||
)
|
||||
|
||||
def __init__(self, context, script, method, outputs, inputs, flags=()):
|
||||
def __init__(self, context, script, method, outputs, inputs, flags=(), localized=False):
|
||||
ContextDerived.__init__(self, context)
|
||||
self.script = script
|
||||
self.method = method
|
||||
self.outputs = outputs if isinstance(outputs, tuple) else (outputs,)
|
||||
self.inputs = inputs
|
||||
self.flags = flags
|
||||
self.localized = localized
|
||||
|
||||
suffixes = (
|
||||
'.c',
|
||||
|
|
|
@ -1023,9 +1023,12 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
computed_host_flags.resolve_flags('RTL', [rtl_flag])
|
||||
|
||||
generated_files = set()
|
||||
localized_generated_files = set()
|
||||
for obj in self._process_generated_files(context):
|
||||
for f in obj.outputs:
|
||||
generated_files.add(f)
|
||||
if obj.localized:
|
||||
localized_generated_files.add(f)
|
||||
yield obj
|
||||
|
||||
for path in context['CONFIGURE_SUBST_FILES']:
|
||||
|
@ -1122,14 +1125,14 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
for f in files:
|
||||
if (var in ('FINAL_TARGET_PP_FILES',
|
||||
'OBJDIR_PP_FILES',
|
||||
'LOCALIZED_FILES',
|
||||
'LOCALIZED_PP_FILES') and
|
||||
not isinstance(f, SourcePath)):
|
||||
raise SandboxValidationError(
|
||||
('Only source directory paths allowed in ' +
|
||||
'%s: %s')
|
||||
% (var, f,), context)
|
||||
if var.startswith('LOCALIZED_') and not f.startswith('en-US/'):
|
||||
if var.startswith('LOCALIZED_'):
|
||||
if isinstance(f, SourcePath) and not f.startswith('en-US/'):
|
||||
raise SandboxValidationError(
|
||||
'%s paths must start with `en-US/`: %s'
|
||||
% (var, f,), context)
|
||||
|
@ -1150,6 +1153,21 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
('Objdir file listed in %s not in ' +
|
||||
'GENERATED_FILES: %s') % (var, f), context)
|
||||
|
||||
if var.startswith('LOCALIZED_'):
|
||||
# Further require that LOCALIZED_FILES are from
|
||||
# LOCALIZED_GENERATED_FILES.
|
||||
if f.target_basename not in localized_generated_files:
|
||||
raise SandboxValidationError(
|
||||
('Objdir file listed in %s not in ' +
|
||||
'LOCALIZED_GENERATED_FILES: %s') % (var, f), context)
|
||||
else:
|
||||
# Additionally, don't allow LOCALIZED_GENERATED_FILES to be used
|
||||
# in anything *but* LOCALIZED_FILES.
|
||||
if f.target_basename in localized_generated_files:
|
||||
raise SandboxValidationError(
|
||||
('Outputs of LOCALIZED_GENERATED_FILES cannot be used in %s: ' +
|
||||
'%s') % (var, f), context)
|
||||
|
||||
# Addons (when XPI_NAME is defined) and Applications (when
|
||||
# DIST_SUBDIR is defined) use a different preferences directory
|
||||
# (default/preferences) from the one the GRE uses (defaults/pref).
|
||||
|
@ -1289,12 +1307,14 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
unicode(path),
|
||||
[Path(context, path + '.in')])
|
||||
|
||||
generated_files = context.get('GENERATED_FILES')
|
||||
if not generated_files:
|
||||
generated_files = context.get('GENERATED_FILES') or []
|
||||
localized_generated_files = context.get('LOCALIZED_GENERATED_FILES') or []
|
||||
if not (generated_files or localized_generated_files):
|
||||
return
|
||||
|
||||
for f in generated_files:
|
||||
flags = generated_files[f]
|
||||
for (localized, gen) in ((False, generated_files), (True, localized_generated_files)):
|
||||
for f in gen:
|
||||
flags = gen[f]
|
||||
outputs = f
|
||||
inputs = []
|
||||
if flags.script:
|
||||
|
@ -1327,7 +1347,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
script = None
|
||||
method = None
|
||||
yield GeneratedFile(context, script, method, outputs, inputs,
|
||||
flags.flags)
|
||||
flags.flags, localized=localized)
|
||||
|
||||
def _process_test_manifests(self, context):
|
||||
for prefix, info in TEST_MANIFESTS.items():
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
LOCALIZED_GENERATED_FILES += [ 'foo.xyz' ]
|
||||
|
||||
foo = LOCALIZED_GENERATED_FILES['foo.xyz']
|
||||
foo.script = 'generate-foo.py'
|
||||
foo.inputs = [
|
||||
'en-US/localized-input',
|
||||
'non-localized-input',
|
||||
]
|
||||
|
||||
# Also check that using it in LOCALIZED_FILES does the right thing.
|
||||
LOCALIZED_FILES += [ '!foo.xyz' ]
|
|
@ -418,6 +418,30 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||
self.maxDiff = None
|
||||
self.assertEqual(lines, expected)
|
||||
|
||||
def test_localized_generated_files(self):
|
||||
"""Ensure LOCALIZED_GENERATED_FILES is handled properly."""
|
||||
env = self._consume('localized-generated-files', RecursiveMakeBackend)
|
||||
|
||||
backend_path = mozpath.join(env.topobjdir, 'backend.mk')
|
||||
lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:]]
|
||||
|
||||
expected = [
|
||||
'libs:: foo.xyz',
|
||||
'GARBAGE += foo.xyz',
|
||||
'EXTRA_MDDEPEND_FILES += foo.xyz.pp',
|
||||
'foo.xyz: %s/generate-foo.py $(call MERGE_FILE,localized-input) $(srcdir)/non-localized-input $(if $(IS_LANGUAGE_REPACK),FORCE)' % env.topsrcdir,
|
||||
'$(REPORT_BUILD)',
|
||||
'$(call py_action,file_generate,--locale=$(AB_CD) %s/generate-foo.py main foo.xyz $(MDDEPDIR)/foo.xyz.pp $(call MERGE_FILE,localized-input) $(srcdir)/non-localized-input)' % env.topsrcdir,
|
||||
'',
|
||||
'LOCALIZED_FILES_0_FILES += foo.xyz',
|
||||
'LOCALIZED_FILES_0_DEST = $(FINAL_TARGET)/',
|
||||
'LOCALIZED_FILES_0_TARGET := libs',
|
||||
'INSTALL_TARGETS += LOCALIZED_FILES_0',
|
||||
]
|
||||
|
||||
self.maxDiff = None
|
||||
self.assertEqual(lines, expected)
|
||||
|
||||
def test_exports_generated(self):
|
||||
"""Ensure EXPORTS that are listed in GENERATED_FILES
|
||||
are handled properly."""
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
LOCALIZED_GENERATED_FILES += [ 'abc.ini' ]
|
||||
LOCALIZED_FILES += [ '!abc.ini' ]
|
|
@ -0,0 +1,6 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
GENERATED_FILES += [ 'abc.ini' ]
|
||||
LOCALIZED_FILES += [ '!abc.ini' ]
|
|
@ -0,0 +1,6 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
LOCALIZED_GENERATED_FILES += [ 'abc.ini' ]
|
||||
FINAL_TARGET_FILES += [ '!abc.ini' ]
|
|
@ -0,0 +1,5 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
LOCALIZED_GENERATED_FILES += [ 'abc.ini', ('bar', 'baz') ]
|
|
@ -462,6 +462,7 @@ class TestEmitterBasic(unittest.TestCase):
|
|||
self.assertEqual(len(objs), 3)
|
||||
for o in objs:
|
||||
self.assertIsInstance(o, GeneratedFile)
|
||||
self.assertFalse(o.localized)
|
||||
|
||||
expected = ['bar.c', 'foo.c', ('xpidllex.py', 'xpidlyacc.py'), ]
|
||||
for o, f in zip(objs, expected):
|
||||
|
@ -471,6 +472,53 @@ class TestEmitterBasic(unittest.TestCase):
|
|||
self.assertEqual(o.method, None)
|
||||
self.assertEqual(o.inputs, [])
|
||||
|
||||
def test_localized_generated_files(self):
|
||||
reader = self.reader('localized-generated-files')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
self.assertEqual(len(objs), 2)
|
||||
for o in objs:
|
||||
self.assertIsInstance(o, GeneratedFile)
|
||||
self.assertTrue(o.localized)
|
||||
|
||||
expected = ['abc.ini', ('bar', 'baz'), ]
|
||||
for o, f in zip(objs, expected):
|
||||
expected_filename = f if isinstance(f, tuple) else (f,)
|
||||
self.assertEqual(o.outputs, expected_filename)
|
||||
self.assertEqual(o.script, None)
|
||||
self.assertEqual(o.method, None)
|
||||
self.assertEqual(o.inputs, [])
|
||||
|
||||
def test_localized_files_from_generated(self):
|
||||
"""Test that using LOCALIZED_GENERATED_FILES and then putting the output in
|
||||
LOCALIZED_FILES as an objdir path works.
|
||||
"""
|
||||
reader = self.reader('localized-files-from-generated')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
self.assertEqual(len(objs), 2)
|
||||
self.assertIsInstance(objs[0], GeneratedFile)
|
||||
self.assertIsInstance(objs[1], LocalizedFiles)
|
||||
|
||||
def test_localized_files_not_localized_generated(self):
|
||||
"""Test that using GENERATED_FILES and then putting the output in
|
||||
LOCALIZED_FILES as an objdir path produces an error.
|
||||
"""
|
||||
reader = self.reader('localized-files-not-localized-generated')
|
||||
with self.assertRaisesRegexp(SandboxValidationError,
|
||||
'Objdir file listed in LOCALIZED_FILES not in LOCALIZED_GENERATED_FILES:'):
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
|
||||
def test_localized_generated_files_final_target_files(self):
|
||||
"""Test that using LOCALIZED_GENERATED_FILES and then putting the output in
|
||||
FINAL_TARGET_FILES as an objdir path produces an error.
|
||||
"""
|
||||
reader = self.reader('localized-generated-files-final-target-files')
|
||||
with self.assertRaisesRegexp(SandboxValidationError,
|
||||
'Outputs of LOCALIZED_GENERATED_FILES cannot be used in FINAL_TARGET_FILES:'):
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
def test_generated_files_method_names(self):
|
||||
reader = self.reader('generated-files-method-names')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче