Giter VIP home page Giter VIP logo

font-line's People

Contributors

chrissimpkins avatar codacy-badger avatar dependabot-preview[bot] avatar dependabot[bot] avatar moyogo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

font-line's Issues

Support for web fonts

Need to explore the fontTools library support.

Will need to take into account that line spacing may be handled differently in the browser setting, perhaps modify the approach with these file types. From Tim Brown in TypeKit blog comment:

Happy to share this info, although it’s not super interesting for most people. We’re constantly learning, but here’s what we know right now: Windows browsers use Win metrics, Mac browsers use hhea metrics, and Firefox on Linux uses Typo metrics unless the hhea values are greater. Win and hhea metrics must match, including an hhea linegap of zero. Typo linegap has to be zero too, or lines of text are spaced unpredictably across browsers.

The specific values to which metrics should be changed are unique to each font file. Our internal tools for foundry partners make recommendations based on the conditions I just mentioned, and also based on the maximum ascent/descent of glyphs in the font file.

Note TypoLineGap has to be zero comment.

pip install fails due to permission error

Hello,
I'm a Fedora 27 user with Python 2.7.14 version.
When I type pip install font-line from ./local/share/fonts it gives the following error:

$ pip install font-line
Collecting font-line
  Using cached font_line-0.7.1-py2.py3-none-any.whl
Collecting standardstreams (from font-line)
  Using cached standardstreams-0.2.0-py2.py3-none-any.whl
Collecting commandlines (from font-line)
  Using cached commandlines-0.4.1-py2.py3-none-any.whl
Collecting fontTools (from font-line)
  Using cached fonttools-3.21.2-py2.py3-none-any.whl
Installing collected packages: standardstreams, commandlines, fontTools, font-line
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 365, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 854, in install
    strip_file_prefix=strip_file_prefix
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
    strip_file_prefix=strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib64/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permiso denegado: '/usr/lib/python2.7/site-packages/standardstreams-0.2.0.dist-info'

It seems it can't write to /usr/lib/

Option to modify ┬ │ ┼ ┴ ├ ┤┘└┌ ┐ glyph heights

Hello, this issue is a feature-request/request-for-advice that is most likely way out of scope and potentially not even possible to apply consistently across different fonts --I am not enough of an expert to know. Perhaps there is an alternate tool that may do what I want.

From the readme, "font-line does not modify the glyph set or hints applied to the font". However, I would like to increase the height of four glyphs: ┬ │ ┼ ┴ ├ ┤┘└┌ ┐ so that the vertical components reach the top and the bottom.

Use case:
I use the monospaced font Inconsolata in a terminal with Tmux (which allows you to have multiple windows inside your terminal by rendering ASCII borders). It looks like this with the font line spacing increased by 80% with this tool:
Screen Shot 2019-11-09 at 9 37 37 am

Once the line spacing is increased, the vertical border characters no longer span the full glyph height and appear broken. I would like it to appear unbroken:
Screen Shot 2019-11-09 at 9 51 30 am

In the image above I have made a hack-ey attempt adjusting the heights in FontForge, but it requires some guesswork and eyeballing and it requires a lot of trial and error. Is there a programmatic way to achieve this, stretch the glyphs to either vertically span from top to bottom, or alternatively, vertically scale these glyphs to compensate for the percentage line space increase?

Font link: https://github.com/ryanoasis/nerd-fonts/releases/download/v2.0.0/InconsolataLGC.zip
font-line command: font-line percent 80 Inconsolata\ LGC\ Nerd\ Font\ Complete.ttf

font-line will be upgrading to Py3.6+ support only!

Coming soon.

The fontTools library is transitioning to Py3.6+ support as of the v4.0.0 library release. This project will be updated with changes that eliminate support for Py2.7 and bump the Py3 interpreter version to Py3.6+.

Line spacing/vertical metrics approach discussion thread

@davelab6 @kenlunde

Be interested in your expertise & thoughts about the approach that we are using to set and modify the line spacing/internal leading in fonts with this tool. Vertical metrics modifications have been a common request among developers who use the Hack typeface because few text editors aimed at developers currently support line spacing adjustments. We are restricted to modification of the font files in order to broadly support tighter and looser line spacing. While highly subjective, the issue matters to developers because some like to fit as much code into a view as humanly possible (the small font size, tightly line spaced crowd) and others want improved legibility that comes with additional whitespace between lines.

I based our vertical metrics modifications approach on Karsten Lücke's approach defined here.

The details of the OpenType table metrics changes are in the project README file here and the calculations are performed in the modify_linegap_percent() function defined in this module.

Report data modification and writing back to fontfile!

First of all thanks for the great tool. Very handy.
I am just asking/suggesting a feature improvement. In the next update if it is possible please add an option to write back the modified fontreport.txt data to the fontfile. That would be very fancy feature to have!
Thank You.

Better error handling? Crashes when an attribute is not present

Try getting a font-line report on these fonts:

https://github.com/schmiddim/Kobo-Touch-Firmware--1.9.17/tree/master/usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib/fonts

I get:

Traceback (most recent call last):
  File "/usr/local/bin/font-line", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/fontline/app.py", line 54, in main
    stdout(get_font_report(fontpath))
  File "/Library/Python/2.7/site-packages/fontline/commands.py", line 22, in get_font_report
    os2_x_height = tt['OS/2'].sxHeight
AttributeError: 'table_O_S_2f_2' object has no attribute 'sxHeight'

Maybe this scenario could be dealt with better?

Maybe there could be a command line option to silence error output?

Until then I will have to hack around it in the shell script I am working on (or not use those fonts).

ps: Thanks for this tool! It surprised me how difficult it is to get the metrics data on the command line.

Add test font for missing attribute issue

Fixed in v0.7.1

TODO:

  • Add a test font that is missing xHeight and CapHeight values in the OS/2 table. User provided commercial fonts that cannot be added to this repo for redistribution with tests.

Original issue report #14

Bug fix committed in 123fbb7

shebang issue

had to reinstall this recently and had an issue where python was not found

-bash: /usr/local/bin/font-line: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

it's recommended to use this instead

#!/usr/bin/env python

Percent command does not properly calculate line spacing when fonts define TypoAscender + TypoDescender > UPM

reported by @alphapapa in source-foundry/Hack#191 (comment):

Hey Chris,

I just tried the 15% command, but it increased the line spacing instead of reducing it:

$ font-line report FiraCode-Regular.otf 

=== FiraCode-Regular.otf ===
Version 1.102;PS 001.102;hotconv 1.0.88;makeotf.lib2.5.64775
SHA1: 87fda07094d49978382399e0532b021ef8fb6b02

--- Metrics ---
[head] Units per Em:    1000
[head] yMax:            1050
[head] yMin:            -500
[OS/2] TypoAscender:    935
[OS/2] TypoDescender:   -265
[OS/2] WinAscent:       935
[OS/2] WinDescent:      265
[hhea] Ascent:          935
[hhea] Descent:         -265

[hhea] LineGap:         0
[OS/2] TypoLineGap:     0

--- Height Calculations by Table Values ---
[OS/2] TypoAscender to TypoDescender:   1200
[OS/2] WinAscent to WinDescent:         1200
[hhea] Ascent to Descent:               1200

--- Delta Values ---
WinAscent to TypoAscender:      0
Ascent to TypoAscender:         0
WinDescent to TypoDescender:    0
Descent to TypoDescender:       0

--- Ratios ---
(Typo Asc + Desc + Linegap) / UPM:      1.2
(winAsc + winDesc) / UPM:               1.2
(hhea Asc + Desc) / UPM:                1.2


$ font-line percent 15 FiraCode-*.otf
[font-line] 'FiraCode-Bold.otf' successfully modified to 'FiraCode-Bold-linegap15.otf'.
[font-line] 'FiraCode-Regular.otf' successfully modified to 'FiraCode-Regular-linegap15.otf'.

$ font-line report FiraCode-Regular-linegap15.otf 

=== FiraCode-Regular-linegap15.otf ===
Version 1.102;PS 001.102;hotconv 1.0.88;makeotf.lib2.5.64775
SHA1: 269660e4c91ed4de6c91f7823514c4cafe4d3a93

--- Metrics ---
[head] Units per Em:    1000
[head] yMax:            1050
[head] yMin:            -500
[OS/2] TypoAscender:    935
[OS/2] TypoDescender:   -265
[OS/2] WinAscent:       1025
[OS/2] WinDescent:      355
[hhea] Ascent:          1025
[hhea] Descent:         -355

[hhea] LineGap:         0
[OS/2] TypoLineGap:     180

--- Height Calculations by Table Values ---
[OS/2] TypoAscender to TypoDescender:   1200
[OS/2] WinAscent to WinDescent:         1380
[hhea] Ascent to Descent:               1380

--- Delta Values ---
WinAscent to TypoAscender:      90
Ascent to TypoAscender:         90
WinDescent to TypoDescender:    90
Descent to TypoDescender:       90

--- Ratios ---
(Typo Asc + Desc + Linegap) / UPM:      1.38
(winAsc + winDesc) / UPM:               1.38
(hhea Asc + Desc) / UPM:                1.38

Then I uninstalled the original version of the fonts, installed the new fonts, and restarted Emacs, and the line spacing is indeed increased.

Font weight changed after changing the interline spacing

After changing the interline spacing bold font looks too bold.

Before:
2

After:
1

Though I'm unsure whether this is a font-line issue because I got very similar results after increasing the interline spacing manually with fontforge.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.