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
modify_font strikethrough_position isn't respected on macOS #5946
Comments
The code to adjust these is backend independent so I dont see how it |
The code for modifying the positions is all in fonts.c see the calc_cell_metrics() it has nothing platform specific in it. |
Hmmm doesn't it call
if (self->strikethrough_position != 0) {
*strikethrough_position = MIN(*cell_height - 1, (unsigned int)font_units_to_pixels_y(self, MAX(0, self->ascender - self->strikethrough_position)));
} else {
*strikethrough_position = (unsigned int)floor(*baseline * 0.65);
}
if (self->strikethrough_thickness > 0) {
*strikethrough_thickness = MAX(1, font_units_to_pixels_y(self, self->strikethrough_thickness));
} else {
*strikethrough_thickness = *underline_thickness;
} and *strikethrough_position = (unsigned int)floor(*baseline * 0.65); and: *strikethrough_thickness = *underline_thickness; |
Yes, that sets the initial position, which comes from the font file. The |
ok thanks - I'll see if I can find the actual issue then. |
Hi @kovidgoyal - I believe it's the if (baseline_before != baseline) {
int adjustment = baseline - baseline_before;
baseline = adjust_ypos(baseline_before, cell_height, adjustment);
underline_position = adjust_ypos(underline_position, cell_height, adjustment);
strikethrough_position = adjust_ypos(underline_position, cell_height, adjustment);
} instead it should be: strikethrough_position = adjust_ypos(strikethrough_position, cell_height, adjustment); I was incorrect re strikethrough thickness, that's working ok. |
Great, thanks 👍 |
Describe the bug
The modify_font strikethrough_position config option isn't respected - it's just hardcoded.
To Reproduce
Steps to reproduce the behavior:
(on macOS)
1.Set modify_font strikethrough_position 3
2. Have a look at the strikethrough position using, say,
echo -e "\e[9mstrikethrough\e[0m"
3. Set modify_font strikethrough_position -3
4. Have a look at the strikethrough position, it will be the same as step 2
Environment details
... I can see in core_text.m it's just hardcoded as compared with freetype.c. (I also note that strikethrough_thickness just comes from the underline thickness and can't be independently set, again in comparison to the freetype implementation - let me know if you want a separate ticket for that)
Thanks.
The text was updated successfully, but these errors were encountered: