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

[Wishes] Find and Replace Script and ... #609

Closed
Arno-Enslin opened this issue May 22, 2016 · 5 comments
Closed

[Wishes] Find and Replace Script and ... #609

Arno-Enslin opened this issue May 22, 2016 · 5 comments

Comments

@Arno-Enslin
Copy link

Arno-Enslin commented May 22, 2016

@ behdad

Maybe you remember, that I had posted my batch file a while ago, with the help of which I comment ttx files, especially the name table. The comments shall ease the renaming, restyling and so on.

My batch file makes use of the Windows tool SSR, which can be downloaded "here".

SSR works perfectly fine for that purpose, but much better would be a Python find and replace script, because first it would be platform independent and second Python is already installed, if the FontTools are installed. Unfortunately I was unable to find such a Python script in the web with a license, that would allow the integration into the FontTools.

For the case, that you agree with me, that such a script would be very useful: Maybe you find the time to write such a script.


And the other wish. Have a look at "this" thread, please. This could be alternatively (to the AFDKO) included in the FontTools.

@anthrotype
Copy link
Member

Basically you want a generic text manipulation tool like sed but written in Python.
I'm sorry but I don't think fonttools is the right place for that.
You can have a look at the documentation of the re module, e.g. the re.sub function:
https://docs.python.org/3/library/re.html#re.sub

@Arno-Enslin
Copy link
Author

In principle understandable. It is only font related, if you use it for fonts. But the same is true for the base64 script. You can also use it for images or anything else.

@davelab6
Copy link
Contributor

@Arno-Enslin you might like http://www.xmlsh.org/Commands :)

@Arno-Enslin
Copy link
Author

Arno-Enslin commented May 23, 2016

@ davelab6

The point is, that I don't need a find and replace script for myself. For my purposes SSR is fine. But my batch script (which comments the name table and more) is useless for people, who cannot install SSR, because they are not on Windows.

The solution with the comments is good in my opinion, because the comments can be individualized. If TTX would comment its output directly, as (more or less) proposed by another user of the FontTools a few weeks ago, it would be less comfortable. The user had asked for a less cryptical output.

I am searching for the most compact solution. And because Python is already installed, if you use the AFDKO or FontTools only, a Python script would be probably the best.

However. If the main developers of FontTools disagree, that such a script could be very useful with regard to the handling of TTX files, it is not the right place to continue the discussion.

And thanks for the link.

Edit: I can hardly believe, that such a script does not already wait for download, because find and replace operations are not an unusual task.

Edit 2:

@ anthrotype

I like the "cryptical" output of TTX. Please don't change that.

@behdad
Copy link
Member

behdad commented May 30, 2016

@Arno-Enslin what you really want is a Unix-like environment :)

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

No branches or pull requests

4 participants