5

Powerline is some sort of plugin for Vim and Gvim. In order to be more useful it uses fonts that has some pictures (symbols) added to them. In other words they've "patched" the font set. Recently Powerline stated that the code has been changed and you have to patch your fonts again. The link to the same can be found here.

Questions

  • Can I patch my already patched font, again, or should I get a fresh source font?
  • What kind of fonts can be patched. (TTF for example or ...)?
r004
  • 3,339
  • 8
  • 29
  • 51
  • Can you please cite the source that states you need to patch your font set again? – slm Jul 02 '14 at 13:06
  • @slm The code points have changed in this version of Powerline! This means that you either have to patch your font again, or change the glyphs Powerline uses in your user configuration. – r004 Jul 02 '14 at 13:27
  • 1
    http://powerline.readthedocs.org/en/latest/installation/linux.html – r004 Jul 02 '14 at 13:28

1 Answers1

3

The patch script is accessible here in it's own GitHub repo, titled: powerline-patcher.

An experiment

I first started by downloading the above patching script.

$ git clone https://github.com/Lokaltog/powerline-fontpatcher.git

I then selected a sample .ttf file to test out your question.

$ ls -lr | grep ttf
-rw-r--r--. 1 saml saml 242700 Jul  2 20:29 LucidaTypewriterRegular.ttf

Running the font patching script produced the following output:

$ scripts/powerline-fontpatcher LucidaTypewriterRegular.ttf 
The glyph named fraction is mapped to U+2215.
But its name indicates it should be mapped to U+2044.
The glyph named periodcentered is mapped to U+2219.
But its name indicates it should be mapped to U+00B7.
The glyph named macron is mapped to U+02C9.
But its name indicates it should be mapped to U+00AF.
The glyph named stigma is mapped to U+03DA.
But its name indicates it should be mapped to U+03DB.
The glyph named digamma is mapped to U+03DC.
But its name indicates it should be mapped to U+03DD.
The glyph named koppa is mapped to U+03DE.
But its name indicates it should be mapped to U+03DF.
The glyph named sampi is mapped to U+03E0.
But its name indicates it should be mapped to U+03E1.
The glyph named fraction1 is mapped to U+2044.
But its name indicates it should be mapped to U+2215.

With the resulting file:

$ ls -lr | grep ttf
-rw-r--r--. 1 saml saml 242700 Jul  2 20:29 LucidaTypewriterRegular.ttf
-rw-rw-r--. 1 saml saml 242576 Jul  2 21:02 Lucida Sans Typewriter Regular for Powerline.ttf

If I run it 2 more times on the resulting files, I get the same output each time as above, resulting in files looking like this:

$ ls -ltr | grep ttf
-rw-r--r--. 1 saml saml 242700 Jul  2 20:29 LucidaTypewriterRegular.ttf
-rw-rw-r--. 1 saml saml 242576 Jul  2 21:02 Lucida Sans Typewriter Regular for Powerline.ttf
-rw-rw-r--. 1 saml saml 242780 Jul  2 21:04 Lucida Sans Typewriter Regular for Powerline for Powerline.ttf
-rw-rw-r--. 1 saml saml 242984 Jul  2 21:07 Lucida Sans Typewriter Regular for Powerline for Powerline for Powerline.ttf

All these resulting .ttf files appear valid when I attempt to open them using ImageMagick's display command:

$ display Lucida Sans Typewriter Regular for Powerline for Powerline for Powerline.ttf

    ss #1

Takeaways

So it would seem you can reprocess font files using the patching script, it's unclear to me why the size keeps growing as you perform this operation, so I would keep the originals handy just in case you encounter problems.

If it was me, I would probably ditch the previously patched files and regenerate them just to be on the safe side.

References

slm
  • 363,520
  • 117
  • 767
  • 871
  • Thanks for the experiment; by size if you mean file size (in kb) it is because of adding Glyphs to the file. and The font in question costs about 25$ So better if I was not force to pay twice. (that font was patched before I bought it). – r004 Jul 03 '14 at 10:19
  • @r004 - yeah I wasn't sure why the files kept growing as I re-ran the patch tool. Looking at the script it's doing some calculations using the original fonts for those questions, so I'm imagining that it's regenerating glyphs from glyphs, perhaps? – slm Jul 03 '14 at 13:16