-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Kazuraki breaks assumptions about hanmen layout #138
Comments
私はちょうどそれを言及するつもりでした。 |
...and it looks like Harfbuzz won't help me here. > text = "として"
> SILE.shaper:shapeToken(text, SILE.font.loadDefaults({ font = "Kazuraki SPN", direction = "TTB", language = "ja" }))
{
{
codepoint = 1699,
depth = 0,
height = 8.81,
name = "",
width = 10,
},
{
codepoint = 1682,
depth = 0,
height = 13.31,
name = "",
width = 10,
},
{
codepoint = 1697,
depth = 0,
height = 7.97,
name = "",
width = 10,
},
} That's meant to be a single ligature, I think. |
OK, I just had lunch with Behdad and he explained the problem. To use Kazuraki font, you also have to add However, because |
Not sure what you mean... Are you telling HarfBuzz that this is vertical layout or not? What "other" problems do you mean? |
Hey Behdad! Yes, we're telling Harfbuzz it's vertical. There are two problems:
In this example, there is not enough space between 日 and 本 (本 should be positioned lower = 日 advance is not big enough) and か and ら. To be honest I think the metric code is suspect. (See this thread on the HB mailing list.) Here is the code from void calculate_extents(box* b, hb_glyph_info_t glyph_info, hb_glyph_position_t glyph_pos, FT_Face ft_face, double point_size, hb_direction_t direction) {
FT_Error error = FT_Load_Glyph(ft_face, glyph_info.codepoint, FT_LOAD_NO_SCALE);
if (error) return;
FT_Glyph glyph;
error = FT_Get_Glyph(ft_face->glyph, &glyph);
if (error) return;
FT_BBox ft_bbox;
FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_UNSCALED, &ft_bbox);
FT_Fixed advance;
FT_Get_Advance(ft_face, glyph_info.codepoint, FT_LOAD_NO_SCALE, &advance);
const FT_Glyph_Metrics *ftmetrics = &ft_face->glyph->metrics;
b->width = advance * point_size / ft_face->units_per_EM;
if (direction == HB_DIRECTION_TTB) {
FT_Get_Advance(ft_face, glyph_info.codepoint, FT_LOAD_NO_SCALE | FT_LOAD_VERTICAL_LAYOUT, &advance);
b->height = advance * point_size / ft_face->units_per_EM;
b->depth = 0;
} else {
b->height = ft_bbox.yMax * point_size / ft_face->units_per_EM;
b->depth = -ft_bbox.yMin * point_size / ft_face->units_per_EM;
}
FT_Done_Glyph(glyph);
} |
I think one way to handle this, is to apply the JIS X 4051 spacing rules after shaping not before it. I think you will need output glyph to input character mapping (which you will need anyway for #110 anyway) as JIS X 4051 rules are character based, but this can be done using |
What @khaledhosny said. |
Implementing #179 has made this now work! |
The Kazuraki font is a calligraphic Japanese font, which contains vertical ligatures. Currently we shape Japanese characters independently, so the ligatures are never triggered. Also some of the vertical spacing is totally wrong.
The text was updated successfully, but these errors were encountered: