GithubHelp home page GithubHelp logo

sebdesign / cap-height Goto Github PK

View Code? Open in Web Editor NEW
84.0 6.0 5.0 1.09 MB

Calculate the cap height of fonts loaded with Web Font Loader

License: MIT License

JavaScript 100.00%
typography web-font-loader height-calculation font-metrics

cap-height's Issues

Cap-Width

Hey @sebdesign, is there a way to get the character width for a font using your cap-height JS?

I am wanting to easily calculate the max-width of a paragraph/line-of-text should be based on characters per line, font-size, and character width.

Thank you for this awesome tool!

Uncaught RangeError: Cannot calculate the height of whitespace.

Hello,

I'm getting the following error in the console:

  | g | @ | cap-height.js:1
-- | -- | -- | --
  | apply | @ | lodash.js:496
  | wrapper | @ | lodash.js:5356
  | thru | @ | lodash.js:8812
  | (anonymous) | @ | lodash.js:4379
  | arrayReduce | @ | lodash.js:704
  | baseWrapperValue | @ | lodash.js:4378
  | wrapperValue | @ | lodash.js:9067
  | h | @ | cap-height.js:1
  | (anonymous) | @ | (index):550

I've included cap-height.js manually right at the bottom of my project:

<script src="https://unpkg.com/[email protected]"></script>
<script src="src/scripts/uncompiled/cap-height.js"></script>
<script>
    capHeight.calculate({});
</script>

And using TypeKit in the <head>. Any ideas?

Many thanks!

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.