-
Notifications
You must be signed in to change notification settings - Fork 608
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
hb-view: option to set a fixed line-height? #2402
Comments
Your patch looks good I believe and the feature is also a nice one, feel free to upload it as a PR, thanks :) |
Thanks for the reply! I'll bring it into a better shape and submit a PR. |
So this is my objection to Please add |
@behdad thank you for the feedback!
If you mean in the patch from my original comment, that was just some throwaway code to demonstrate the intent; I should actually remove it from my comment. But with the code from the PR I submitted, the fonts seem to line up... here's a before/after comparison on a hundred randomly picked Google Fonts: The Before image is from upstream/master with
I'll try to figure out how we can express the intent in terms of these two options. |
Care to tell us how your |
Well, I may be misunderstanding some basic concepts, but when you draw the glyphs in Cairo, their origin is at the baseline, right? so for each line The basic point of the PR is to replace the font-dependent |
@danburzo I think you're just using the wrong term. What you are talking about and drawing there is generally known as "baseline skip" (to borrow from LaTeX lingo), not line height (which is kind of a nebulous thing defined differently in the HTML/CSS world than everywhere else. Well basically just everywhere. The (very nice) thing you are accomplishing by forcing the baseline skip the way you seem to be is known as grid typesetting. You're setting consecutive baselines at an arbitrary fixed value apart from each-other and positioning the font ascender-decenders relative to that. It's a very useful little trick, line-height probably just isn't the best word for it. |
Yes, in retrospect, I have no idea why I went for the CSS term 😅. And @behdad, thank you for taking the time for the additional explanations.
My proposal was altering the formulas (i.e. imposing a baseline position) when there's a For the position of baselines, from:
For the height of the image, from:
It may not be the best name for an option, nor the ideal, most flexible, approach to only send the sum of font extent values (can I call it leading?). I had more modest requirements — images of fonts with their baselines aligned. For that, and nothing more, I believe(d) a single, fixed Going back to your suggestion of specifying explicit font extents, it indeed provides a better mapping to existing concepts while also ensuring that:
|
Hi everyone,
I've been poking around
hb-view
to generate PNG previews for font files, and I was wondering if it's possible to add a CLI option that sets a fixed line-height (leading) for the text, as opposed to the configurable--line-space
that gets added to the font's height:harfbuzz/util/view-cairo.cc
Line 49 in b2a965d
Such an option would allow the user to generate previews with aligned baselines (second row):
Not sure I'm underspecifying this and there are complexities that I'm missing, but I thought I'd ask.
Here's my hack job to test this out:Edit: Removed throwaway code
The text was updated successfully, but these errors were encountered: