bdf2x icon indicating copy to clipboard operation
bdf2x copied to clipboard

Fix string comparisons

Open taylordotfish opened this issue 2 years ago • 0 comments

When testing whether the first word of a line in the BDF file matches a specific string, the word is treated as matching as long as it is a prefix of the string. For example, when testing whether a line begins with "CAP_HEIGHT", if the first word of the line is simply "CA", this is considered a match, because only the first two characters are checked.

This is a problem because some BDF files do contain lines that consist of "CA", as part of their hexadecimal bitmap data. X11's standard 8x13 font is one such case. These lines will be incorrectly treated as CAP_HEIGHT lines, and the resulting output will not be well-formed.

For example, these lines of 8x13.bdf:

BITMAP
00
00
CA
A4

are incorrectly translated to:

BITMAP
0000
0000
0000
0000
CA
CC30
CC30

This PR modifies the string comparisons so that a full match is required.

taylordotfish avatar Sep 05 '23 10:09 taylordotfish