Skip to content

Check the presence of glyphs when selecting font #106

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

Closed

Conversation

bwikbs
Copy link
Member

@bwikbs bwikbs commented Jun 9, 2021

No description provided.

@bwikbs
Copy link
Member Author

bwikbs commented Jun 9, 2021

#96

bwikbs and others added 2 commits June 9, 2021 11:22
Signed-off-by: MuHong Byun <mh.byun@samsung.com>

Co-authored-by: Boram Bae <boram21.bae@samsung.com>
Signed-off-by: MuHong Byun <mh.byun@samsung.com>

Co-authored-by: Boram Bae <boram21.bae@samsung.com>
Signed-off-by: MuHong Byun <mh.byun@samsung.com>

Co-authored-by: Boram Bae <boram21.bae@samsung.com>
@bwikbs bwikbs marked this pull request as ready for review June 10, 2021 01:30
@bwikbs
Copy link
Member Author

bwikbs commented Jun 10, 2021

dump_screen
A problem was identified in a specific case. Cause analysis is required.

  • Galaxy Watch3, Gallery App

@bwikbs
Copy link
Member Author

bwikbs commented Jun 10, 2021

A patch was created based on the analysis of @bbrto21.(#96) The above situation has been resolved.
But..I'm not sure this is right approche of this. 😢

Signed-off-by: MuHong Byun <mh.byun@samsung.com>
Copy link

@bbrto21 bbrto21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to re-enable fontconfig in azure-pipelines.

if (utf16Pos == 0 || family.get() != lastFamily) {

if (utf16Pos == 0 || family.get() != lastFamily ||
family.get()->getLastMatchedCodePoint() != ch) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This algorithm tries to reuse the already selected font as much as possible.
I think that using only one codepoint cached causes too much execution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Maybe I should use map for this.

@@ -528,8 +530,8 @@ void FontCollection::itemize(const uint16_t* string,
}
start -= prevChLength;
}
result->push_back(
{family->getClosestMatch(style), static_cast<int>(start), 0});
result->push_back({family->getClosestMatchWithChar(style, ch),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also use variant to check glyphs?

result = hb_font_get_glyph(hb_font, codepoint, variant, &unusedGlyph);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about variant selector, so I looked it up. I think you're right. 😄

@@ -164,6 +164,46 @@ FakedFont FontFamily::getClosestMatch(FontStyle style) const {
return FakedFont{nullptr, FontFakery()};
}

FakedFont FontFamily::getClosestMatchWithChar(FontStyle style,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core algorithm is similar to FakedFont FontFamily::getClosestMatch(FontStyle style)
I think you can make one nice method for these two.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok~ Thanks!

@bbrto21
Copy link

bbrto21 commented Jun 11, 2021

And it still have the similar problem as the image attached below.

dump_screen

@bwikbs
Copy link
Member Author

bwikbs commented Jun 11, 2021

And it still have the similar problem as the image attached below.

dump_screen

OMG! It's not easy...

Signed-off-by: MuHong Byun <mh.byun@samsung.com>
@bbrto21
Copy link

bbrto21 commented Jun 11, 2021

@bwikbs
I've made some progress based on your work, I think it's almost done. but there is room for improvement, so please refer to this in your implementation.
bbrto21@563b60c (I worked on it after revert 6e859d7, 28dbd02)

dump_screen-1
dump_screen-2
dump_screen-3
dump_screen-4

…, it is checked more.

Signed-off-by: MuHong Byun <mh.byun@samsung.com>

Co-authored-by: Boram Bae <boram21.bae@samsung.com>
@bwikbs
Copy link
Member Author

bwikbs commented Jun 11, 2021

@bbrto21 I put your implementation as a patch. As you said, there seems to be no problem. Thanks. 👍
Reverting existing code and applying fontconfig seem to be a little different topic, so I would like to talk about it in another PR.

Signed-off-by: MuHong Byun <mh.byun@samsung.com>
@bbrto21
Copy link

bbrto21 commented Jun 11, 2021

@bwikbs @HakkyuKim
According to further investigation, unfortunately, SamsungOneUI font family has color emoji font.
It is sometimes chosen for non-emoji characters. Especially when rendering text with only numbers it is always selected.

Signed-off-by: MuHong Byun <mh.byun@samsung.com>
@bwikbs
Copy link
Member Author

bwikbs commented Jun 14, 2021

No matter how much I think about it, I can't find an answer, so I made a workaround that the emoji goes backwards when sorting.
@bbrto21 @HakkyuKim How do you think? It works in all cases as we found before.

@bwikbs
Copy link
Member Author

bwikbs commented Jun 14, 2021

Go on #113

@bwikbs bwikbs closed this Jun 14, 2021
swift-kim pushed a commit that referenced this pull request Sep 1, 2022
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.

2 participants