34 Commits

Author SHA1 Message Date
Andrew Suzuki
68dbfba5c4 Ensure names attr exists on table__n_a_m_e 2024-12-22 10:44:06 -05:00
Khaled Hosny
ae31d05605 [ttLib] Fix warning when calling addMultilingualName() with "ar" name
I get warning from _makeMacName() because it does not have a TTFont, but
the font is there, just not passed from addMultilingualName() ->
findMultilingualName() -> _makeMacName().
2023-08-13 14:21:32 +03:00
Johannes Neumeier
f52b3da721 Make NameRecord comparison not fail on encoding errors #3006 2023-02-24 15:58:53 +02:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Olli Meier
61ad06fc3a rename unittest with better name + get rid of redundant code 2022-02-11 17:51:52 +01:00
Olli Meier
1d51bc2b8e Changes as requested by Just. 2022-02-11 15:55:25 +01:00
Olli Meier
68fa3bbd47 Cleaning code based on feedback from Just 2022-02-10 22:13:58 +01:00
Olli Meier
384415f573
Update Tests/ttLib/tables/_n_a_m_e_test.py
Co-authored-by: Just van Rossum <justvanrossum@gmail.com>
2022-02-10 21:59:39 +01:00
Olli Meier
4a0b559caf
Update Tests/ttLib/tables/_n_a_m_e_test.py
Co-authored-by: Just van Rossum <justvanrossum@gmail.com>
2022-02-10 21:59:29 +01:00
Olli Meier
e968e8fd7f Based on the discussion with Just and anthrotype: Undo the changes in the name table and extend unittests. If there are inconsistencies in the name table, it's ok to create new name IDs, even if this might not be the most efficient way of creating the name table. 2022-02-10 21:24:51 +01:00
Olli Meier
51eda21b0a Adding more unittests, based on feedback. 2022-02-10 17:11:26 +01:00
Olli Meier
1649973800 Make use of 'Best' in names 2022-02-09 17:44:28 +01:00
Olli Meier
1a16b24cd5 Fix unittests 2022-02-09 17:17:11 +01:00
Olli Meier
c50f38ed0e extend name table with getFamilyName, getSubFamilyName and getNiceFullName + unittests 2022-02-09 17:06:02 +01:00
Khaled Hosny
232b2ccbc4 Move the rest of py23 module to textTools
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02: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
Cosimo Lupo
d8c42ef7f0
codecs: handle errors different from 'strict' for extended mac encodings
Fixes #2132
2020-12-24 20:37:52 +01:00
Just van Rossum
dc7d016538
[ttLib.tables._n_a_m_e] Fix #1997: Only attempt to recovered malformed data from bytes (#1998)
* don't attempt to recover malformed data from str, only from bytes. Fixes #1997
2020-06-16 16:35:40 +02:00
Just van Rossum
90c7c7fae1
Fix for #1985: ensure that the AxisNameID in the STAT table is > 255 (#1986)
Fix for #1985:
* ensure that the AxisNameID in the STAT table is not less than 256. This needed an additional argument to the addMultiLingualName() name table method.
* fvar axis name IDs must also not be less than 256, just like STAT axis names.
2020-06-08 19:39:28 +02:00
Just van Rossum
db26cf804e
[ttLib.name] Fix findMultilingualName() (#1963)
* when reading from binary, name.string may be an encoded bytes sequence: we should call toUnicode() before we compare to the requested string

* fix expected output
2020-05-16 11:29:23 +02:00
Just van Rossum
4febf38be2
[ttLib.name] Add nameTable.findMultilingualName() method (#1921)
* add nameTable.findMultilingualName(), to find an existing multilingual name
* Make addMultilingualName() reuse nameIDs if possible when asking for a new nameID, by calling findMultilingualName()
2020-05-07 11:06:51 +02:00
Nikolaus Waxweiler
e4f7495f32 [name] Be less cautious about getting data for NameRecord comparisons 2019-10-11 17:39:56 +01:00
Nikolaus Waxweiler
2e82438d93 [name] Handle duplicate name records with different string types 2019-10-11 14:24:03 +01:00
Cosimo Lupo
e9c7a5227a
_n_a_m_e_test: more tests for removeNames 2019-09-11 15:01:46 +02:00
Marc Foley
4e316cae57 [name] add removeNames method to table__n_a_m_e 2019-09-11 11:56:09 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
justvanrossum
e22453c933 followup to #1531 2019-03-06 16:47:16 +01:00
justvanrossum
0d06fd23ce fix test failure in addMultilingualName() test by setting mac to None, which makes it behave like before 2018-11-02 12:12:57 +01:00
Miguel Sousa
efca91e7f1 [_n_a_m_e_test] ensure that struct format string is native str
https://github.com/fonttools/fonttools/pull/1193#issuecomment-367769342
2018-02-23 03:02:06 -08:00
Sascha Brawer
3f839878eb [name] Fix issues with name.addMultilingualName()
Fixes https://github.com/fonttools/fonttools/issues/931.
2017-04-21 13:14:24 +08:00
Sascha Brawer
a5c8977dd3 [name] Fix platform ID for names whose language code is in ltag table
https://github.com/fonttools/fonttools/issues/931
2017-04-20 17:38:31 +08:00
Sascha Brawer
e8530360bd [name] Add helper for building multi-lingual names
Fixes https://github.com/fonttools/fonttools/issues/921.
2017-04-19 02:26:32 +08:00
Cosimo Lupo
e1d340cc65
[Tests] use absolute imports and add __init__.py where relevant
We can't use relative imports any more since the tests are now located outside the package.

I had to add __init__.py to Tests/feaLib/ so that pytest does not get confused by the presence
of two test files with the same basename: i.e. Tests/feaLib/builder_test.py and Tests/feaLib/builder_test.py

https://github.com/pytest-dev/pytest/issues/774
http://stackoverflow.com/questions/12582503/py-test-test-discovery-failure-when-tests-in-different-directories-are-called
2017-01-16 09:14:13 +00:00
Cosimo Lupo
78ad48eaf3
Move all *_test.py modules and test data to external Tests/ folder 2017-01-16 09:14:12 +00:00