Skip to content
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

Corrupt 'loca' table after convert #11

Open
pablopla opened this issue Aug 22, 2024 · 8 comments
Open

Corrupt 'loca' table after convert #11

pablopla opened this issue Aug 22, 2024 · 8 comments

Comments

@pablopla
Copy link

I'm trying to convert the attached eot file from a pptx presentation with libeot latest commit.
The ttf font doesn't open in Debain 12 and 'fonttols ttx font1.ttf' gives me a warning:
WARNING: corrupt 'loca' table, or wrong numGlyphs in 'maxp': -1 1151

font1.zip

Is there something wrong with the original font or the conversion?
Is it possible to fix the loca table in the ttf font?

@umanwizard
Copy link
Owner

umanwizard commented Aug 25, 2024

Confirmed, this is because the font file doesn't have a glyf table. Instead it has a CFF table: see https://learn.microsoft.com/en-us/typography/opentype/spec/cff .

We only rebuild the loca table if the glyf table is present. To fix this bug I probably need to also build it in the case of a CFF table (probably also CFF2).

@umanwizard
Copy link
Owner

I think we actually shouldn't emit loca at all in this case.

Can you try with the latest commit in master?

@pablopla
Copy link
Author

Thank you for the patch.
With the latest commit I'm not getting an error but I'm not able to use the font. Double clicking on the font under Debain 12 gives me an error This font could not be displayed and I can't use it in LibreOffice when I place it under the ~/.fonts dir.

libeot/eot2ttf font1.fntdata font1.ttf
has table: CFF 
has table: DSIH
has table: GDEF
has table: GPOS
has table: GSUB
has table: OS/2
has table: cmap
has table: head
has table: hhea
has table: hmtx
has table: maxp
has table: name
has table: post

When I'm trying to install eot2ttf with make install and running it from /usr/local/bin/eot2ttf I'm getting an error:
EOT out of spec: no blank loca table found!
Shouldn't it work the same as running it from the local libeot/eot2ttf dir?

@umanwizard
Copy link
Owner

I am able to open the resulting font in fontforge. It will take me a bit longer to investigate why it doesn't work in gnome-font-viewer or libreoffice.

I'll leave this issue open in the meantime.

The issue with make install is a separate problem. I suspect the eot2ttf it is installing is pointing to your system version of libeot rather than the libeot built from this repo. System libeot is many years old and many bugs have been fixed since then. Maybe you can override via LD_LIBRARY_PATH.

@pablopla
Copy link
Author

ots-sanitize is able to fix the font. It gives a wrong sfntVersion for glyph data warning.
diff of the ttx files shows small changes in sfntVersion, checkSumAdjustment and DSIH.

sudo apt-get install opentype-sanitizer
ots-sanitize font1.ttf font1-santized.ttf
WARNING: wrong sfntVersion for glyph data
File sanitized successfully!
sudo apt-get install fonttools
ttx font1.ttf
ttx font1-santized.ttf
diff font1.ttx font1-santized.ttx
2c2
< <ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.38">
---
> <ttFont sfntVersion="OTTO" ttLibVersion="4.38">
1163c1163
<     <checkSumAdjustment value="0x0"/>
---
>     <checkSumAdjustment value="0x5372b4d3"/>
20424,20429d20423
< 
<   <DSIH raw="True">
<     <hexdata>
<       00000001 00000000  
<     </hexdata>
<   </DSIH>

@pablopla
Copy link
Author

The eot is otf. this PR fixes the magic number #2 and output a working font.
Any chance you could include the fix?

@umanwizard
Copy link
Owner

Hi @pablopla , can you try with the pr-2 branch: https://github.com/umanwizard/libeot/tree/pr-2

Also, are you able to share the .eot ?

@pablopla
Copy link
Author

It works. Thank you.
The font is attached to the first message in this issue.

Can you please tag a new release? It might help distros to update their libeot version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants