-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why use UTF16ToUTF8() ? #70
Comments
Library assumes all encoding are UTF16 by default without taking in consideration the PlatformID provided I have overcome this issue by subclassing the name table class and overriding _parse() function $font = \FontLib\Font::load($path);
//Replace old table
$tables = $font->getTable();
$table = new \Additions\Table\Type\nameEncoding($tables['name']);
$table->parse();
$font->setTableObject('name', $table);
$font->getFontPostscriptName(); class nameEncoding extends name {
private static $header_format = array(
"format" => self::uint16,
"count" => self::uint16,
"stringOffset" => self::uint16,
);
protected function _parse() {
// override here
}
} |
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
The global conversion from UTF16 was, mostly, according the spec. Relating to platform ID 0 (Unicode):
Relating to platform ID 3 (Windows):
However, it is also true that other encodings may be used (as seen in the supplied font). While I haven't completely addressed the underlying deficiency in how the library handles string encoding, the changes implemented for the next release should be sufficient for most cases. Expanded encoding support will be built out as needed based on user feedback. |
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
I noticed that the sample font provided uses cmap subtable format 2, which isn't yet supported. I added support for that format and improved encoding support in other areas of the library so that the next release will correctly re-encode this font. The re-encoded font now loads correctly in browsers that do not load the original font due to spec compliance issues. |
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
Most name strings should be encoded with UTF-16BE per the spec, but there are situations where other encodings are required or acceptable. This change only addresses a subset of potential encodings. fixes #70
Hi:
I'm from china, and there many chinese fonts. When i use getFontName() or other function like this, the return value is not valid, but if i remove the UTF16ToUTF8() call, it's the thing we want.
Issue.zip
The text was updated successfully, but these errors were encountered: