Giter Club home page Giter Club logo

Comments (8)

dabrahams avatar dabrahams commented on May 28, 2024

Actually I think this was due to me using the font's ascender, descender, and line gap values rather than its hhea ascender, hhea descender, and hhea line gap! The documentation should really be clear about which to use.

I'm not certain I entirely like the results I'm getting using the capsize formulas; will follow up with my own for comparison.

from capsize.

dabrahams avatar dabrahams commented on May 28, 2024

Yeah, the results I get using my own formulas match capsize, now that I am feeding it the right metric values.

from capsize.

dabrahams avatar dabrahams commented on May 28, 2024

Sorry about the close. Reopening to deal with the documentation issue.

from capsize.

michaeltaranto avatar michaeltaranto commented on May 28, 2024

Thanks for digging into this. Glad you're finding the technique useful.

I am wanting to do a documentation and site uplift but just haven't had time to do it. I would suggest that documenting the internal metrics tables is not really something the Capsize documentation would do. Capsize deliberately tries to abstract that detail away where possible.

I based a lot of my work on this fantastic post: Deep dive CSS: font metrics, line-height and vertical-align by Vincent De Oliveira. This really helps identify which parts of the metrics the browse cares about when rendering.

Hope that helps.

from capsize.

dabrahams avatar dabrahams commented on May 28, 2024

I would suggest that documenting the internal metrics tables is not really something the Capsize documentation would do. Capsize deliberately tries to abstract that detail away where possible.

It also exposes APIs that take ascent, descent, and lineGap parameters. If I am trying to use this API, I'm going to dig up those values. If you open a font with FontLab you will find values with those labels prominently available in the "family dimensions" pane
image
when the ones you actually want for use with capsize are buried in "other values":
image

This just seems like a recipe for failure of other users. I had actually read the article by Mr. De Olivera and when I didn't see hhea in the metrics displayed by FontLab, I assumed that the software omitted that particular label. It was only on my 3rd re-reading of the article that it occurred to me to dig further to find the relevant values.

from capsize.

michaeltaranto avatar michaeltaranto commented on May 28, 2024

Yep agreed, from a Capsize perspective, the documentation failure is not about which tables to look at, rather how to use the suite of capsize packages to extract these values (without needing FontLab).

  • The @capsizecss/unpack package does this for you and will extract the metrics from the font given a url or a file.
  • The @capsizecss/metrics package does this for you and provides you with system metrics as well as google fonts, directly importable (and typed!)

I finally merged the site update this morning, which cross links with the github repo and also "Step 3" on the site now highlights which packages to use based on your selection.

Hopefully you find this more interactive and helpful.

from capsize.

dabrahams avatar dabrahams commented on May 28, 2024

It's your prerogative to leave out these four characters if you want of course, but FWIW that doc update wouldn't have solved the problem for me. I have a proprietary font file that I can't upload. The code in “step 3” doesn't show me any reference to a filename; it's (still) completely non-obvious to me that digging into the "step 3" example is going to help me run the code on my font file.

On the other hand, I know there are ways to get the metrics of any font—just use a font editor and examine them—so I do that, and I look for the measurements whose names match your parameters…

Anyway, I'll stop arguing now, because I don't want to annoy you to the point where you don't want to answer this question. 😉

from capsize.

michaeltaranto avatar michaeltaranto commented on May 28, 2024

Ah sorry, for clarity the readme was also updated and in the fontMetrics documentation it points you to the correct metrics extraction package for your use case.

There are many consumers who wouldn't know about the internals of fonts, and Capsize does its best to abstract that away. In particular, with the new packages meaning you dont have to know about ascent, descent etc unless you have to customise the values due to incorrect data in the font tables.

PS Im not annoyed or arguing btw 😄 just providing clarity around decisions taken so far. I did miss the discussion topic though, i'll have a look.

from capsize.

Related Issues (20)

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.