Skip to content

Commit

Permalink
Merge pull request #350 from yeslogic/glyf
Browse files Browse the repository at this point in the history
Add part of glyf and loca to OpenType format
  • Loading branch information
wezm authored Apr 28, 2022
2 parents be5bdc0 + 74a6f67 commit 7563731
Show file tree
Hide file tree
Showing 10 changed files with 1,664 additions and 5 deletions.
54 changes: 54 additions & 0 deletions formats/data/opentype/woff/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
WOFF Test Fonts
===============

The fonts in this subdirectory are from the [WC3 WOFF WG test suite][woff].
Licensed under the [W3C Software and Document Notice and License][licence].

### Font Info

* `valid-001.ttf`: CFF
* `valid-005.ttf`: TTF simple glyph

### Generating The Fonts

The fonts were generated via a docker container as follows.
The container was used because the scripts require Python 2:

docker run --rm -it -v $(pwd):/woff debian:8-slim

Then in the container:

cd /woff
apt update
apt install fonttools python-numpy
adduser wmoore
cd generators
python FormatTestCaseGenerator.py

Then outside the container the fonts were converted back to TTFs from the WOFF files:

for f in valid-00*.woff; do woff2sfnt-zopfli "$f" > "${f%.woff}.ttf"; done

where `woff2sfnt-zopfli` is <https://github.com/bramstein/sfnt2woff-zopfli>.

### License

> By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
>
> Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications:
>
> * The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
> * Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included.
> * Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
>
> ### Disclaimers
>
> THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
>
> COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
>
> The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders.
[woff]: https://github.com/w3c/woff/tree/c8402e6a5a892d45ba8193c22aed06be92833be2
[licence]: http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document

320 changes: 320 additions & 0 deletions formats/data/opentype/woff/valid-001.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,320 @@
stdout = '''
0 = [
{
start = 0,
directory = {
sfnt_version = 1330926671,
_sfnt_version = {},
num_tables = 9,
search_range = 128,
entry_selector = 3,
range_shift = 16,
table_records = [
{
table_id = 1128678944,
checksum = 2312911615,
offset = 1280,
length = 558,
link = 1280,
},
{
table_id = 1330851634,
checksum = 2107474081,
offset = 256,
length = 96,
link = 256,
},
{
table_id = 1668112752,
checksum = 11469276,
offset = 1016,
length = 230,
link = 1016,
},
{
table_id = 1751474532,
checksum = 4199932307,
offset = 156,
length = 54,
link = 156,
},
{
table_id = 1751672161,
checksum = 200869999,
offset = 212,
length = 36,
link = 212,
},
{
table_id = 1752003704,
checksum = 399966408,
offset = 1840,
length = 16,
link = 1840,
},
{
table_id = 1835104368,
checksum = 282624,
offset = 248,
length = 6,
link = 248,
},
{
table_id = 1851878757,
checksum = 720423648,
offset = 352,
length = 663,
link = 352,
},
{
table_id = 1886352244,
checksum = 4290248754,
offset = 1248,
length = 32,
link = 1248,
},
],
},
},
]
156 = [
{
major_version = 1,
_major_version = {},
minor_version = 0,
font_revision = 65536,
checksum_adjustment = 1155811448,
magic_number = 1594834165,
_magic_number = {},
flags = 3,
units_per_em = 1000,
_units_per_em = {},
created = 3374127268,
modified = 3374417235,
glyph_extents = {
x_min = 100,
y_min = -10,
x_max = 2204,
y_max = 710,
},
mac_style = 0,
lowest_rec_ppem = 3,
font_direction_hint = 2,
index_to_loc_format = 0,
glyph_data_format = 0,
},
]
212 = [
{
major_version = 1,
_major_version = {},
minor_version = 0,
ascent = 750,
descent = -250,
line_gap = 9,
advance_width_max = 2304,
min_left_side_bearing = 100,
min_right_side_bearing = 100,
x_max_extent = 2204,
caret_slope = {
rise = 1,
run = 0,
},
caret_offset = 0,
_reserved0 = 0,
_reserved1 = 0,
_reserved2 = 0,
_reserved3 = 0,
metric_data_format = 0,
number_of_long_horizontal_metrics = 4,
},
]
248 = [
{
version = 20480,
num_glyphs = 4,
},
]
256 = [
{},
]
352 = [
{
table_start = 352,
version = 0,
name_count = 14,
storage_offset = 174,
},
]
1016 = [
{
table_start = 1016,
version = 0,
num_tables = 3,
encoding_records = [
{
platform = 0,
encoding = 3,
subtable_offset = {
offset = 28,
link = 1044,
},
},
{
platform = 1,
encoding = 0,
subtable_offset = {
offset = 76,
link = 1092,
},
},
{
platform = 3,
encoding = 1,
subtable_offset = {
offset = 28,
link = 1044,
},
},
],
},
]
1044 = [
{
table_start = 1044,
format = 4,
data = {
length = 48,
language = 0,
seg_count_x2 = 8,
seg_count = 4,
search_range = 8,
entry_selector = 2,
range_shift = 0,
end_code = [
32,
70,
80,
65535,
],
_reserved_pad = 0,
start_code = [
32,
70,
80,
65535,
],
id_delta = [
-31,
-68,
-77,
1,
],
id_range_offsets = [
0,
0,
0,
0,
],
},
},
]
1092 = [
{
table_start = 1092,
format = 6,
data = {
length = 154,
language = 0,
first_code = 9,
entry_count = 72,
glyph_id_array = [
1,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
3,
],
},
},
]
1248 = [
{},
]
1280 = [
{},
]
1840 = [
{
h_metrics = [],
},
]
'''
stderr = ''
Binary file added formats/data/opentype/woff/valid-001.ttf
Binary file not shown.
Loading

0 comments on commit 7563731

Please sign in to comment.