/ionic-font-metrics

Ionic app to measure text elements

Primary LanguageJavaScriptMIT LicenseMIT

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!)