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

Bold+Italic variant? #5

Closed
benjamindblock opened this issue Jul 27, 2022 · 5 comments
Closed

Bold+Italic variant? #5

benjamindblock opened this issue Jul 27, 2022 · 5 comments

Comments

@benjamindblock
Copy link

First, wanted to say thanks for making such a great font! I've been using it for the past six months and love it. Having standard, bold, and italic variants really makes it stand out (and much more useful as a result) among the other bitmap fonts I've come across.

Would you consider making a bold+italic font variant?

The three variants provided currently cover 95% of my use cases, but with kitty's font config I do run into occasional cases where the bold_italic_font is expected and I have to use a fallback. Having a bold+italic for Greybeard would really complete this font and make it usable across all applications I need.

Thanks! Feel free to close if it's not something you're interested in (or if it's not possible to do with the design of the font at its current sizes).

@flowchartsman
Copy link
Owner

flowchartsman commented Aug 3, 2022

I think the caveat from the original font probably applies:

greybeard/build/FAQ

Lines 128 to 134 in b50a975

* What about the missing italics?
In a bitmap font, italics work only (in as aesthetically acceptable
way) if certain relationships between the character height, the
character width, the stroke width and the inter-character space are
satisfied. For 8x16 it works, for 9x18 it works at a pinch, for 6x12,
7x14 and 11x12 it doesn't. Bold italics are even worse. Sorry.

Doing it the "right way" would involve making an entire new glyph set by hand which is a non-starter (at least for me). If some enterprising brave soul wanted to do it, I wouldn't stop them, but it's a lot.

Having said that, there IS an old tool that's designed specifically for this purpose: http://hp.vector.co.jp/authors/VA013651/freeSoftware/mkbold-mkitalic.html

Though I haven't tried it. The results might be awful, or they might mostly work, however you'd probably want to make sure you only applied it to the glyphs that are actually italic and not already bold (i.e. not the Hebrew ones), and I'm guessing there would be some manual tweaking necessary after that. I might take a crack at it later, but if you want to get this done sooner, that's where I'd start. If it works out, please submit a PR to add it to the build system.

Based on nothing other than my gut feeling, I would say to start with mkbold on the italic variant, rather than mkitalic on the bold variant, since italic has its own sylistic elements compared to the normal font, and I don't know if mkitalic is smart enough to do that.

@flowchartsman
Copy link
Owner

flowchartsman commented Aug 3, 2022

Hah! I may have spoken too soon. Preliminary results from mkbold on the italic version of 18px doesn't actually look TOO awful.

image

It might not be too much work to integrate this into the preliminary build Dockerfile in font-files, which already has mkbold-mkitalic installed, however this isn't used yet, and it still needs Java and bitsnpicas in the Dockerfile to work. Promising, though. Can't guarantee I can get to it any time soon, but if you were to feel the itch, the command I used was just:

mkbold Greybeard-18px-Italic.bdf > Greybeard-18px-BoldItalic.bdf

Then I added the bdf to the toplevel Makefile ttfs target. The only necessary change after that was some replacements on the generated BDF header (the space was Required, though I don't know if it is necessary in both the FONT and WEIGHT_NAME directives, since I forget which one bitsnpicas uses to generate the ttf)

And then I had to manually edit the header of the BDF to refer to it as a Bold Italic (space required) like so:

FONT -AW-Greybeard-18px-Bold Italic-I-Normal--18-170-75-75-C-90-ISO10646-1
SIZE 18 75 75
FONTBOUNDINGBOX 9 18 0 -4
STARTPROPERTIES 21
FONTNAME_REGISTRY ""
FOUNDRY "AW"
FAMILY_NAME "Greybeard 18px"
WEIGHT_NAME "Bold Italic"
SLANT "I"

So that would need to be scripted somehow, but it's do-able!

@flowchartsman
Copy link
Owner

flowchartsman commented Aug 3, 2022

The right way is probably to do a one-time conversion using mkbold and then manually go through and tweak the glyphs that look bad. Any volunteers? :D

@benjamindblock
Copy link
Author

Thanks for all the details and references! I gave the conversion a shot with some updated parameters

  • -r for a right shifted image
  • -L to reflect the left edge
mkbold -r -L Greybeard-18px-Italic.bdf > Greybeard-18px-BoldItalic.bdf

It looks like it helped preserve some of the shapes a bit better (P, Q, etc.) and is a great start for personal use. I haven't tweaked glyphs manually before, but when I have some free time I may give it a shot!

Comparison

Screen Shot 2022-08-03 at 5 12 48 PM

Screen Shot 2022-08-03 at 5 12 23 PM

@flowchartsman
Copy link
Owner

flowchartsman commented Aug 28, 2022

This is now integrated into the new build process, and the files are available in /dist!

I'm using the flags you were using, which does indeed look better, however I'm still not satisfied with the cropping. There are also some "missing" internal pixel artifacts, but it's unclear if there is any kind of simple approach that might fix that. Worst comes to worst, we could probably create a character-by character fix list for the ASCII characters and get 90% of the way there with that. I've opened #6 to track this.

But I digress. Now we have BoldItalic fonts! Yay! Thanks for your submission!

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