Capítulo 890 de 988

Chapter 890: measureText()

Core Idea

_Part of the @remotion/layout-utils package.

Key Concepts

  • Example
  • API
  • text
  • fontFamily
  • fontSize
  • fontWeight
  • letterSpacing
  • fontVariantNumeric<AvailableFrom v="4.0.57"/>

Code Examples

const text = 'remotion';
const fontFamily = 'Arial';
const fontWeight = '500';
const fontSize = 12;
const letterSpacing = '1px';

measureText({
  text,
  fontFamily,
  fontWeight,
  fontSize,
  letterSpacing,
}); // { height: 14, width: 20 }
  • What it demonstrates: Usage pattern for measureText() from the official docs.

Key Takeaways

  1. Understand example when working with measureText().
  2. Understand api when working with measureText().
  3. Understand text when working with measureText().
  4. Understand fontfamily when working with measureText().
  5. Understand fontsize when working with measureText().

Connects To

  • Best Practices: related page in the Layout Utils (@remotion/layout-utils) section.
  • Debug: related page in the Layout Utils (@remotion/layout-utils) section.
  • Fill Text box: related page in the Layout Utils (@remotion/layout-utils) section.