Skip to content

Handle newly encountered cases in BDF files. #2108

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
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

MattHeffron
Copy link
Contributor

@MattHeffron MattHeffron commented Apr 17, 2025

Better handling of a glyph with ENCODING of -1. (From Monaco-10.bdf converted mac font)
I treat it as the slug glyph, instead of the default of a solid block.
This addresses issue: #2014
None of my test cases had that any glyph with that ENCODING.

This same bdf file also caused corrupted bitmap glyphs due to glyphs with zero width bitmap and zero advance (escapement). This has been corrected in a separate commit.

I treat it as the _slug_ glyph, instead of the _default_ of a solid block.
@MattHeffron MattHeffron added the bug Something isn't working (as per documentation) label Apr 17, 2025
@MattHeffron MattHeffron self-assigned this Apr 17, 2025
@MattHeffron MattHeffron changed the title Better handling of a glyph with ENCODING of -1. Handle newly encountered cases in BDF files. Apr 22, 2025
Glyphs with zero width bitmap *and* zero advance (_escapement_) caused miscalculated glyph offsets into the CHARSETINFO bitmap.
Allow and ignore COMMENT lines preceding the STARTFONT line.
Add error checking for extracting font FAMILY, SIZE, FACE, etc. from the BDF-FONT object.
Add recommendation to documentation to write the DISPLAYFONT files to a directory separate from the system's IL:DISPLAYFONTDIRECTORIES locations.
@pamoroso
Copy link
Contributor

On Linux Mint 22.1 Cinnamon I tested the changes up to edcc0e3 and now BDF:WRITE-BDF-TO-DISPLAYFONT-FILES processes the Commodore 64 font with no errors.

But how can I determine the name of the converted font to feed to the TEdit charlooks menu? I added the directory with the new font to DISPLAYFONTDIRECTORIES but entering c64, c64d, c6416, c6416-mrr, or anything else in the Other field of TEdit's charlooks menu yields Can't find OTHER font c6416-mrr.

@MattHeffron
Copy link
Contributor Author

MattHeffron commented Apr 24, 2025

But how can I determine the name of the converted font to feed to the TEdit charlooks menu? I added the directory with the new font to DISPLAYFONTDIRECTORIES but entering c64, c64d, c6416, c6416-mrr, or anything else in the Other field of TEdit's charlooks menu yields Can't find OTHER font c6416-mrr.

This appears to be due to the way that font files are named.
Since there is no punctuation between the FAMILY and the SIZE in the file name (e.g. C6416 when FAMILY = C64 and SIZE = 16), calls to FONTSAVAILABLE will fail to report the font. (Internally, it does everything in UPPERCASE.)
It does find the file, then it takes apart that filename and checks that the pieces match the original FAMILY, SIZE, etc. original arguments. It takes the first character that is a digit as the beginning of the size. So, for c6416 it splits it to FAMILY = C and SIZE = 6416. The FAMILY doesn't match the C64 it was expecting, so it rejects the match.

Interestingly, calling (FONTCREATE 'C64 16) works correctly.
And, after creating that, FONTSAVAILABLE does succeed, as does using "Other" in TEDIT.

So, what should BDF:WRITE-BDF-TO-DISPLAYFONT-FILES do if the FAMILY argument provided, or internally determined FAMILY, contain any digits?

@nbriggs
Copy link
Contributor

nbriggs commented Apr 24, 2025

I don’t think it should do anything different, but the documentation should say “don’t name fonts with names that end in digits”

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
3 participants