22 Commits

Author SHA1 Message Date
Colin Rofls
b26271cc4d [unicodedata] Fix bug in buildUCD.py
The method that was being used to read the header from the input was
inadvertently dropping the first non-header line on the floor; although
this happens to be okay in some cases (where there is an empty line
after the header) in the case of newer versions of the
ScriptExtensions.txt file, this was causing the generated code to be
missing the first entry, for U+00B7 (MIDDLE DOT)
2025-01-29 11:53:58 -05:00
Behdad Esfahbod
10a61ef7de Update to Unicode 16 2024-09-23 08:46:56 -06:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Cosimo Lupo
8697f91cdc
[unicodedata] map Zmth<->math in ot_tag_{to,from}_script
Fixes https://github.com/fonttools/fonttools/issues/1737
2022-11-11 12:20:37 +00:00
Cosimo Lupo
ea534a4ecf
unicodedata: Update Scripts/Blocks to Unicode 15.0
by re-running the MetaTools/buildUCD.py script using the current UCD
database.
2022-09-23 10:42:55 +01:00
Cosimo Lupo
98f5fd3d5a unicodedata: alias 'jamo' script tag to 'hang'
see https://github.com/googlefonts/ufo2ft/issues/575#issuecomment-1009962836
2022-01-11 17:13:20 +00:00
Cosimo Lupo
09e2d1d548 unicodedata: update the script direction list to Unicode 14.0
same as https://github.com/harfbuzz/harfbuzz/blob/3.2.0/src/hb-common.cc#L514-L613
2022-01-11 13:19:01 +00:00
Yao Wei (魏銘廷)
390640a357
update to unicode 14.0 2021-10-31 23:24:18 +08:00
Just van Rossum
5fc65d7168
Misc py23 cleanups (#2243)
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
justvanrossum
b14e6ecf4c update to unicode 13.0 2020-03-20 14:15:00 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
3f60e732d5
unicodedata_test: update expected results after ucd 12.1 update 2019-06-18 16:28:07 +01:00
Cosimo Lupo
a526b7170c
tests: fix expected results after Unicode 11 update
fixes https://github.com/fonttools/fonttools/issues/1291
2018-07-12 11:35:16 +01:00
Cosimo Lupo
677954d5b9
unicodedata: add ot_tag_to_script function
returns the Unicode script code for a given OpenType script tag, or None if no match is found
2018-01-23 11:45:20 -08:00
Cosimo Lupo
91a8cc33e7
unicodedata: add script_horizontal_direction function
same as harfbuzz hb_script_get_horizontal_direction.

We just hard-code the set of RTL script here, as it doesn't change often anyway.
The function is just syntactic sugar as it all does is basically looking up the
constant RTL_SCRIPTS set.
It's nice to have it here in a central place alongside 'script', 'script_name', etc.
2018-01-19 18:04:33 +00:00
Cosimo Lupo
25b944ccce
typo 2018-01-18 20:24:28 +00:00
Cosimo Lupo
c9259c4723
unicodedata: add ot_tags_from_script function
Fixes https://github.com/fonttools/fonttools/issues/1112

This implements the same logic found in harbfuzz hb-ot-tag.cc to
convert between Unicode (or ISO 15924) script codes to OpenType script
tags as defined at:
https://www.microsoft.com/typography/otspec/scripttags.htm

461a605fde/src/hb-ot-tag.cc (L127)
2018-01-18 20:20:17 +00:00
Cosimo Lupo
99ea0a3986 [unicodedata] add script_code func and 'default' fallback arg
`script_code` does the reverse of `script_name`: it takes a long
script name and returns a 4-letter script code.

Both `script_name` and `script_code` raise KeyError by default,
but can optionally return a default value instead.
2017-11-22 17:46:44 +01:00
Cosimo Lupo
afd2490a6c [unicodedata] add script_name function
Converts four-letter script codes to human-readable long names
2017-11-22 17:41:23 +01:00
Cosimo Lupo
012688ac20 [Tests] adjust unicodedata_test to expect short script codes 2017-11-22 17:41:23 +01:00
Cosimo Lupo
99719a8ccc [Tests] add tests for block and script_extension funcs 2017-11-20 18:17:10 +01:00
Cosimo Lupo
6d8813c00a [Tests] move unicodedata/scripts_test to unicodedata_test 2017-11-20 18:09:56 +01:00