Skip to content

jamesb/ionic-font-metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Font Metrics Module for Fitbit OS

(and an Ionic app to measure text elements)

Screenshot

Contains measurements for the Colfax-Regular system font on the Ionic. Useful for determining the approximate pixel width of an on-screen text element. Currently used in the Stripeways clock face.

To use this module, copy the app/font-metrics.js file into your project. Then:

import { pxWidth } from "./font_metrics"

let words = getSomeTextWhoseSizeIsUnknown() 
let lblWords = document.getElementById("lblWords")
lblWords.text = words

try {
  let width = pxWidth(lblWords)
} 
catch (exc) {
  console.error(exc)
}

If you'd like to contribute measurements for another font into this module, the other files here will build into an app that will help you eyeball those measurements. (A magnifying glass is recommended!)

About

Ionic app to measure text elements

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published