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

Improve patching-under-Windows compat #1786

Merged
merged 3 commits into from
Jan 15, 2025
Merged

Improve patching-under-Windows compat #1786

merged 3 commits into from
Jan 15, 2025

Conversation

Finii
Copy link
Collaborator

@Finii Finii commented Jan 15, 2025

Description

Improve Windows as patching OS compatibility by

  • allowing absolute path to begin with a drive letter
  • assembling path with the system path separator

And finally, for all systems:

  • Specify encoding of glyphnames datafile to avoid surprises

Requirements / Checklist

  • Read the Contributing Guidelines
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan.
    Issue number where discussion took place: #xxx
  • If this contains a font/glyph add its origin as background info below (e.g. URL)
  • Verified the license of any newly added font, glyph, or glyph set. License is: xxx

What does this Pull Request (PR) do?

Apart from other stuff, allow a drive letter in the outputdir parameter:

Example:

PS C:\Program Files (x86)\FontForgeBuilds\bin> .\fontforge.exe
    --script C:\Users\jastr\Downloads\FontPatcher\font-patcher
    --outputdir c:\Users\jastr
    C:\Users\jastr\Downloads\Miosevka12.\Font\Miosevka12\Miosevka-Regular.ttf

How should this be manually tested?

Any background context you can provide?

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

[why]
Although Python can handle a mixture of Windows and Posix path
separators we should use the system one if possible.

[how]
Use os.join()

Signed-off-by: Fini Jastrow <[email protected]>
@Finii Finii changed the title Improve patching under Windows compat Improve patching-under-Windows compat Jan 15, 2025
[why]
Some user reported a unicode decoding issue.

[how]
Usually it should work but when the system has some strange setting the
datafile might be interpreted as something else (not utf8).

When the file is opened as binary it should be decoded as utf*.

Possibly fixes: #1761

Signed-off-by: Fini Jastrow <[email protected]>
@Finii Finii force-pushed the feature/windows-compat branch 2 times, most recently from 21ec336 to 5092991 Compare January 15, 2025 15:34
[why]
On Windows an absolute path can start with the drive letter followed by
a colon. When we sanitize the pathname the colon is replaced by an
underscore.

[how]
Add special handling on Windows.

Signed-off-by: Fini Jastrow <[email protected]>
@Finii Finii force-pushed the feature/windows-compat branch from 5092991 to d4f22a2 Compare January 15, 2025 15:45
@Finii Finii merged commit ae17941 into master Jan 15, 2025
4 checks passed
@Finii Finii deleted the feature/windows-compat branch January 15, 2025 15:46
@Finii Finii mentioned this pull request Jan 15, 2025
3 tasks
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.

1 participant