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

[NOT READY] Update visual images with harfbuzz 1.0.5 #25

Closed
wants to merge 1 commit into from

Conversation

springmeyer
Copy link
Member

When we decide to upgrade harfbuzz to 1.x in bootstrap.sh then we'll need to merge this to keep visual tests passing.

This is because somewhere between harfbuzz 0.9.x and 1.x subtle differences appear in font positioning.

/cc @artemp @talaj @flippmoke @BergWerkGIS

@springmeyer
Copy link
Member Author

@behdad - no action needed here on your part. But cc'ing you just in case you are interested these differences. To recap: the Mapnik visual test suite captures pixel differences. One goal of this is so that we can understand when dependencies of Mapnik might change the look of rendered maps. I've never seen changes before due to harfbuzz - this is the first time an upgrade has triggered visual differences. They mostly look minor and okay, but I'll be investigating more when I have time.

@artemp
Copy link
Member

artemp commented Oct 14, 2015

@springmeyer - I've been using harfbuzz-1.0.4 for a while and I didn't see any visual test related issues - is this for 1.0.5 only ?
<rant> visual tests are so fragile</rant>

@springmeyer
Copy link
Member Author

@springmeyer - I've been using harfbuzz-1.0.4 for a while and I didn't see any visual test related issues - is this for 1.0.5 only ?

Oh, interesting! I only tested with v1.0.5 so perhaps it is some change in harfbuzz within the 1.x series and not between that and v0.9.x. I'll take a closer look.

visual tests are so fragile

By design! Just to be clear: I like the fact that I noticed this and that I had to create this ticket to prepare for migrating the tests to a new harfbuzz version. If you don't like the design then revisit mapnik/mapnik#3049 (comment) and let's discuss there.

@springmeyer
Copy link
Member Author

I've been using harfbuzz-1.0.4 for a while and I didn't see any visual test related issues - is this for 1.0.5 only ?

Confirmed: the change impacting visual results happened between harfbuzz v1.0.4 and v1.0.5.

I suspected harfbuzz/harfbuzz@88da7bb after looking through recent commits, but that does not appear to be the change. Something else...

@springmeyer
Copy link
Member Author

Narrowed down to harfbuzz/harfbuzz@2a9627c.

This patch fixes all visual tests:

diff --git a/include/mapnik/text/harfbuzz_shaper.hpp b/include/mapnik/text/harfbuzz_shaper.hpp
index ac436a1..f1f6dbf 100644
--- a/include/mapnik/text/harfbuzz_shaper.hpp
+++ b/include/mapnik/text/harfbuzz_shaper.hpp
@@ -101,6 +101,7 @@ static void shape_text(text_line & line,
             hb_buffer_set_direction(buffer.get(), (text_item.dir == UBIDI_RTL)?HB_DIRECTION_RTL:HB_DIRECTION_LTR);
             hb_buffer_set_script(buffer.get(), _icu_script_to_script(text_item.script));
             hb_font_t *font(hb_ft_font_create(face->get_face(), nullptr));
+            hb_ft_font_set_load_flags(font,FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING);
             hb_shape(font, buffer.get(), ff_settings.get_features(), ff_count);
             hb_font_destroy(font);

@springmeyer
Copy link
Member Author

solved via mapnik core change. closing.

@springmeyer springmeyer deleted the harfbuzz-1.x branch October 15, 2015 20:57
@behdad
Copy link

behdad commented Oct 15, 2015

Yes, sorry about that. I was undecided whether to make this change of behavior or not. Still not sure how many peoples' code it's breaking. Humm.. The OCD side of me wanted to keep FT_LOAD_DEFAULT as default...

@behdad
Copy link

behdad commented Oct 15, 2015

WDYT, should I change it back?

@behdad
Copy link

behdad commented Oct 15, 2015

I'm reverting the behavior change in HB. See: harfbuzz/harfbuzz#143

@springmeyer
Copy link
Member Author

@behdad - hi, just seeing your comments now - Thank you for letting me know about the revert. I've adapted upstream to use the new API in mapnik/mapnik@5da6563, which is great. But yes, I agree with the revert still as those defaults seem sensible.

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

Successfully merging this pull request may close these issues.

None yet

3 participants