Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixed Issue #8068 - SVG encoding#8415

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

sughandj
Copy link

SVG backend now supports special characters like won symbol with usetex.
#8068

@tacaswelltacaswell added this to the2.1 (next point release) milestoneApr 2, 2017
@tacaswell
Copy link
Member

Does#8286 also fix the same problem?

@sughandj
Copy link
Author

@tacaswell Hi, sorry for the late reply.
I checked out#8286 and tried to reproduce#8068, the warning is not there however, the Won character doesn't show up.
Looks like#8286 doesn't solve#8068.

for i, c in enumerate(enc0.encoding)}

# Make a list of each glyph by splitting the encoding
enc0_list = []
Copy link
Member

Choose a reason for hiding this comment

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

this is the same asenc0_list = [e.split('/') for e in enc0.encoding] ?

Why do this splitting?

Copy link
Author

@sughandjsughandjApr 18, 2017
edited
Loading

Choose a reason for hiding this comment

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

No, that'll make a 2D list, but we need 1D.

The encoding that is generated looks like this['Grave/Acute/Circumflex/Tilde/Dieresis/Hungarumlaut/Ring.....']
Thus splitting at "/" gives us individual character names.
Not only that, each index actually corresponds to its character code
(eg: enc0_list[142] = 'uni20A9' which is the Won character)
Therefore, line 363-364, enumerates the list withi = character code andc = character name and creates a dictionarycharacter code => font index
Later, in the code the glyph is retrieved using this dictionary

if enc:    charcode = enc.get(glyph, None)

Hope this makes sense :)

Copy link
Member

Choose a reason for hiding this comment

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

how has thisever worked if that is the case?

enc0_list += e.split("/")

# Encoding provided by the font file mapping names to index
enc = {i: font.get_name_index(c) or None
Copy link
Member

Choose a reason for hiding this comment

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

This is in a block for when charmap_name == "ADOBE_STANDARD", why change to not use the standard encoding?

I think the fix should probably be fixed above to select a better character map for the file?

Copy link
Author

@sughandjsughandjApr 18, 2017
edited
Loading

Choose a reason for hiding this comment

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

Yes, this is the block whereif charmap_name == "ADOBE_STANDARD" and font_bunch.encoding:
Sincefont_bunch already has Unicode values in them, we don't need to specially use the adobe standard file.
Thus, it was removed completely.

Copy link
Member

Choose a reason for hiding this comment

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

Then the conditional should be changed, not just silently internally ignored.

@@ -382,7 +383,10 @@ def get_glyphs_tex(self, prop, s, glyph_map=None,
charcode = glyph

if charcode is not None:
glyph0 = font.load_char(charcode, flags=ft2font_flag)
if use_glyph:
Copy link
Member

Choose a reason for hiding this comment

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

This should probably be merged up into the conditionals above to simplify the logic?

Copy link
Author

Choose a reason for hiding this comment

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

Thecharcode is set right before we reach this conditionif charcode is not None:
Therefore, it seems like the right spot to decide which font method to use to load thecharcode.

Copy link
Member

Choose a reason for hiding this comment

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

your right, I missed that there was a path to get a non-emptyenc that did not setuse_glyph toTrue.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, this is very problematic, the code path above where you setuse_glyph is a caching mechanism so the second time around this may have the wrong value ofuse_glyph?

@tacaswell
Copy link
Member

Can you explain this changes a bit better? Assume I know nothing about how font encoding works :)

Could you include the changes from#8286 in this PR (or explain why they are wrong!)?

@sughandj
Copy link
Author

@tacaswell I hope the replies to your comments give you more insight of the changes :)
Let me know if you have any other questions.

@tacaswell
Copy link
Member

The test failures look real.

I am still extremely uncomfortable with this change because I do not understand it yet.

This seems to be drastically changing how this code works (by consuming the encoding from the font rather than forcing it to use the adobe character map) but is still leaving a bunch of the old machinery around leaving the code in a very confused state.

@tacaswelltacaswell modified the milestones:2.1 (next point release),2.2 (next next feature release)Aug 29, 2017
# Make a list of each glyph by splitting the encoding
enc0_list = []
for e in enc0.encoding:
enc0_list += e.split("/")
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: one needs to doe.decode("ascii").split("/") to test this PR on Py3.

@anntzeranntzer mentioned this pull requestDec 3, 2018
6 tasks
@anntzer
Copy link
Contributor

I think this has been superseded by#12928 (which owes much to this PR, thanks :)).

@anntzeranntzer closed thisJul 5, 2019
@story645story645 removed this from thefuture releases milestoneOct 6, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@anntzeranntzeranntzer left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@sughandj@tacaswell@anntzer@story645

[8]ページ先頭

©2009-2025 Movatter.jp