-
Notifications
You must be signed in to change notification settings - Fork 261
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
Issue-185 changes #695
base: master
Are you sure you want to change the base?
Issue-185 changes #695
Conversation
please undo all the whitespace changes. they don't look necessary or related and make it very hard to understand what the patch is actually doing. |
I completely replaced 1 function with 3, but I can add the extra whitespaces everywhere if you like (maintaining the style used in the replaced function) ? |
I'll try to clarify. I considered adding JISX0213, but that's a different matter. |
the indentation in src/entities.h is incorrect. it's unclear how you're generating this, but it isn't with the entities.tcl that we've used historically. however it's done, entities.tcl needs to be updated or replaced. |
I wrote a C program to do it, as the format of the website changed and it no longer works. In an ideal situation there would be an entities.h with the prototypes and an entities.c containing the function and the lookup table. jisx0208.h as well. I didn't want to modify the build system or take things that far. We're kinda just putting a bandade on things, without a complete rewrite of gdft.c. There are a lot of things that could be improved. |
we want that logic in the repo so we can verify & keep in sync easier. and we don't want to keep around old scripts that are known to be outdated. |
I'd have to add the header portion of the printing and make it output the file as a whole. I was wondering if there was an irc channel for dev discussion ? |
There is another way I can write gd_UTF8_To_Unicode that uses half as many lines of code as well. |
Ok, i've got the entities_gen.c to replace entities.tcl. My use of FT_Select_Charmap(face, charmap->encoding); is not ideal. It might be best to rewrite that entire section to map the selected encoding to an FT_Select_Charmap call I think only FT_Set_Charmap existed when gdft.c was written. |
If you want to cancel this pull request I don't mind. I can reopen again later once i'm done with all the other changes I need to make. It'll likely be in a broken state for a few days. |
shrug it doesn't cost us anything to leave open |
I think it works now. I'll have to do some extensive testing and look everything over, but i'm close. |
As far as I know this is done, unless someone else sees a problem. |
Should we remove the old "* gdTcl_UtfToUniChar is borrowed from Tcl ..." comment as well ? |
i'm indifferent. if you think the amount of borrowed code is still significant, leaving the comment sounds reasonable. |
Is this done now ? |
What is the status on this PR? |
It works for me, although there have been a handfull of changes in master since april. |
@sterlingpickens could you apply a change (whatever, white space etc) to run the CI again? Last one it was broken. We also improved CI now using github actions on Windows, Mac and linux, intel and ARM. Thanks :) |
I tried to sync with main, hopefully that didn't break it. |
Ok, it looks like adding entities.c to CMakeLists.txt was needed. |
for key in entities: | ||
if name_matcher.match(key): | ||
string = "\t" + "{\"" + key.replace("&", "").replace(";", "") + "\", " | ||
codepoints = entities[key]["codepoints"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pad codepoints out in place:
codepoints = [str(x) for x in entities[key]["codepoints"]]
if len(codepoints) == 1:
codepoints.append("0")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vapier I think it is ok as it is now. This script should be ran by maintainers only anyway, before a release etc.
If you don't see any other thing, are you good to go with this PR? (I am :)
string = string + "0}" | ||
if len(codepoints) > 2: | ||
print("Warning: entity with >2 codepoints detected") | ||
file_ent_c.write(string + ",\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once you do the above tweaks, the final code gets a lot simpler and easier to read. the string concats you've written are very hard to follow, but now you can write:
file_ent_c.write("\t{\"" + key + "\", " + ",".join(codepoints) + "},\n")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to think about this for a few hours. Everything else is done.
I'm not a python coder. Everything I do has been is in C for the past ~10yrs.
Thanks @sterlingpickens :) About the CI, ono every new PR, or push to master or a PR, the builds&tests are ran on the various configurations. You can see the result in the PR or directly here. |
@sterlingpickens And my apologies, it should have been merged long ago. I can give you a hand to get it done. @vapier what are the remaining issues? The Python script, as long as it works, is not very important. It can always be improved later or use jq to create the header file from Json :) |
I approved it for now so the tests will be executed :) |
Had some mistakes in that last commit. |
I have to insert a 0 as a placeholder for the ones with only one codepage, that likely contributes to the "hard to read" aspect of the entities.py main loop. |
Do you mean inside entities.py ? |
the resulting C entities used from freetype functions. I suppose some will never disappear, so we can add a test to ensure we don't break it in future releases. Does it make sense? |
Yes, if the entites.py hits the assert with an error. Then anything it generates will be garbage. |
So, maybe create a backup, and/or refuse to overwrite, the .c/.h entities if any problem is detected. |
backup is in git so we don't need it, no?
The tests should ensure two things:
- the generated entities c file.is correct and build
- the GD functions handle multibytes are handles correctly
…On Sat, Sep 4, 2021, 9:00 AM sterlingpickens ***@***.***> wrote:
So, maybe create a backup, and/or refuse to overwrite, the .c/.h entities
if any problem is detected.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#695 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACE6KA6P4MTYQYLMVLDRB3UAF4U7ANCNFSM43PNAVSQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I don't think freetype will have an issue with any codepages we give it(0 to UINT32_MAX), it'll just print a placeholder glyph if it's not valid. For the entities.c any entity of the form {char *, uint32_t, uint32_t} should be fine. I guess you would like something in the tests directory which validates entities.c/.h ? |
yes :)
…On Sat, Sep 4, 2021, 10:05 AM sterlingpickens ***@***.***> wrote:
I don't think freetype will have an issue with any codepages we give it(0
to UINT32_MAX), it'll just print a placeholder glyph if it's not valid. For
the entities.c any entity of the form {char *, uint32_t, uint32_t} should
be fine.
ie: {char *, uint32_t, uint32_t, uint32_t} would be a problem or
NR_OF_ENTITIES being wrong. We shouldn't have to worry about that if
entities.py works right.
I guess you would like something in the tests directory which validates
entities.c/.h ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#695 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACE6KCZVEKD52DCMWZIZALUAGEHBANCNFSM43PNAVSQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
and also the code who handles the input texts and pass the right codepoints
to freetype.
…On Sat, Sep 4, 2021, 11:20 AM Pierre Joye ***@***.***> wrote:
yes :)
On Sat, Sep 4, 2021, 10:05 AM sterlingpickens ***@***.***>
wrote:
> I don't think freetype will have an issue with any codepages we give it(0
> to UINT32_MAX), it'll just print a placeholder glyph if it's not valid. For
> the entities.c any entity of the form {char *, uint32_t, uint32_t} should
> be fine.
> ie: {char *, uint32_t, uint32_t, uint32_t} would be a problem or
> NR_OF_ENTITIES being wrong. We shouldn't have to worry about that if
> entities.py works right.
>
> I guess you would like something in the tests directory which validates
> entities.c/.h ?
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#695 (comment)>, or
> unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AACE6KCZVEKD52DCMWZIZALUAGEHBANCNFSM43PNAVSQ>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>
|
Ok, I wrote several of those little test programs back in april. I'll try to work up the energy to repurpose and clean some code up for a tests subdir.
|
Thank you @sterlingpickens !! Awesome work! I will do a 2.3.3 release today or later this week, then master will become 2.4 and we can merge this PR. finally, thank you for the hard work and patience :) |
@pierrejoye Is merging this pull request still part of the project? |
These changes should resolve #185
Please, test and let me know if any other changes need to be made.
It is my intent not to break things for other people.