Fixed CJK characters not rendering in new Label Engine [sc-24364]#14235
Closed
uberbrady wants to merge 3 commits intogrokability:masterfrom
Closed
Fixed CJK characters not rendering in new Label Engine [sc-24364]#14235uberbrady wants to merge 3 commits intogrokability:masterfrom
uberbrady wants to merge 3 commits intogrokability:masterfrom
Conversation
|
This pull request has been linked to Shortcut Story #24364: Asian (possibly more) characters don't display on labels. |
PR Summary
|
snipe
reviewed
Feb 15, 2024
snipe
reviewed
Feb 15, 2024
Member
|
I hate this solution, but I hate literally everything else we've talked through more :( |
a5be851 to
dafbabf
Compare
Member
|
@uberbrady this has conflicts now - do we maybe want to re-target this to v7? |
Member
Author
|
Although it's designed to be a non-breaking change - yes, I think retargeting it is probably a smart move. "But it's a non-breaking change!" is probably how most laments begin. |
2 tasks
Member
|
@uberbrady if you still want to move forward with this, can you bring it up to date with develop? |
Member
|
I think this should probably get a refactor, with the new learnings from TCPDF from #17817 - I think they are related. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a surprisingly hard problem to solve for some reason I don't fully understand. But because the new Label rendering engine actually generates PDF's based on fonts that are installed as part of the TCPDF library, not just rendering web pages.
So this solution - while terrible - is an approach that will, in the end, solve the problem. It presents two additional drop-down selects in the Label engine settings, defaulting them to what the current font choices are. There's one for your choice of fixed-width font, and one for your variable-width font. In there, if you pick 'cid0cs' as your font, they will render correctly, for Simplified Chinese. Similarly you can use 'cid0ct' for Traditional Chinese, 'cid0jp' for Japanese, and 'cid0kr' for Korean. (Lovely font names by the way; very intuitive).
There are a ton of other fonts available as well, so for now I've included them all. If we decide to go another way on this - possibly auto-detecting characters from different languages, or something else - we can change it - possibly just showing 'useful' subsets, or maybe doing something else entirely.
But this already is useful because you can quickly test out different font choices and see how the characters render when you do. Additionally, if you 'import' a new font, it should show up on the list (as it's dynamically generated). So if we find new fonts to play with, we can at least try them out.
I have not added the additional translation strings yet because we aren't even convinced we're going to go in this direction. If we do decide to go with this approach, I'll need to get all of those translation strings set up. (Interestingly, we can recommend different font choices for different languages, maybe? Or maybe that's the trick - the fonts you get are based on the language you're configured for? Not sure.)