Skip to content

Scrambled character bitmaps from FontSample for Monaco 10 from BDF #2109

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

Open
nbriggs opened this issue Apr 17, 2025 · 4 comments · May be fixed by #2108
Open

Scrambled character bitmaps from FontSample for Monaco 10 from BDF #2109

nbriggs opened this issue Apr 17, 2025 · 4 comments · May be fixed by #2108
Assignees
Labels
bug Something isn't working (as per documentation)

Comments

@nbriggs
Copy link
Contributor

nbriggs commented Apr 17, 2025

With the latest revision to the BDF font reader/display font writer, doing

(FontSample (FONTCREATE 'MONACO 10 'MRR 0 'DISPLAY)
     0 NIL 'DISPLAY T)

produces a font sample with scrambled bitmaps. It looks as though the character positions from the bitmap are offset by about half a character width. The FontSample output is attached. You should be able to reproduce this with the Monaco-10.bdf that was attached to my previous issue.

Image

@MattHeffron
Copy link
Contributor

This appears to be due to there being 3 characters that have 0 width of the glyph and a 0 width bitmap. I modified the BDF file to make the glyph widths = 1, and then it worked.

I checked and one of my test BDF files had some 0 width glyphs, but non-0 width bitmap. These are not in char set 0, so I never looked at them with FontSample. I may not have time to investigate further until Monday.

@nbriggs
Copy link
Contributor Author

nbriggs commented Apr 18, 2025

Also interesting - looking at the warnings generated by FontForge from loading the Monaco.ttf file:

The following table(s) in the font have been ignored by FontForge
Ignoring 'Zapf glyph reference table
Ignoring 'fasc' font descriptor table
Ignoring "fond" 'FOND' and 'NFNT' family compatibility table
Ignoring 'hdmx' horizontal device metrics table
Ignoring 'meta' metadata table
Bad lookup table: format=4 (40/41), first=65535 last=65535 total glyphs in font=1678
The glyph named commaaccent is mapped to U+021A.
But its name indicates it should be mapped to U+0162.
The glyph named commaaccent is mapped to U+021B.
But its name indicates it should be mapped to U+0163.
The glyph named zerowidthjoiner is mapped to U+200D
But its name indicates it should be mapped to U+FEFF.
The glyph named Ghemiddlehookcyrillic is mapped to U+0496.
But its name indicates it should be mapped to U+0494.
The glyph named ghemiddlehookcyrillic is mapped to U+0497.
But its name indicates it should be mapped to U+0495.
The glyph named sixroman is mapped to U+2179.
But its name indicates it should be mapped to U+2175.
The glyph named uni 2094 is mapped to U+2071.
But its name indicates it should be mapped to U+2094.
The glyph named uni20C8 is mapped to U+20A0.
But its name indicates it should be mapped to U+20C8.

I don't know whether these will result in a BDF file that has things in the wrong place...

@MattHeffron MattHeffron self-assigned this Apr 21, 2025
@MattHeffron MattHeffron added the bug Something isn't working (as per documentation) label Apr 21, 2025
@MattHeffron
Copy link
Contributor

The file cu12.bdf.gz includes characters with the glyph width of 0, but bitmap width non-0.
E.g., U+0300, U+0301, which map to XCCS 0301, 0302, the non-spacing Grave and Acute accent characters. These are correctly rendered in FontSample.

@MattHeffron
Copy link
Contributor

MattHeffron commented Apr 22, 2025

I have a fix for this. At least, with the Monaco-10.bdf provided with issue #2107, it doesn't have the corruption shown.
I have included it in PR #2108 (and I have edited the description there).

@MattHeffron MattHeffron linked a pull request Apr 22, 2025 that will close this issue
MattHeffron added a commit that referenced this issue Apr 22, 2025
Glyphs with zero width bitmap *and* zero advance (_escapement_) caused miscalculated glyph offsets into the CHARSETINFO bitmap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (as per documentation)
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants