Pixel-Based Length Check

Validate that translations fit within pixel-based layout constraints directly from the Editor

The Pixel-Based Length Check (PBLC) allows you to verify whether translations fit within defined layout constraints -- such as maximum width, height, and number of lines -- directly from the GL Strings Editor. Instead of exporting files and running external tools, you can run the check in-editor and immediately see which strings pass or fail.

Table of Contents


How It Works

The PBLC measures the pixel dimensions of each translation using the font and layout parameters you define via custom metadata fields. It then compares the measured dimensions against your specified bounding box constraints and assigns a status to each string:

  • Accepted -- the translation fits within the defined constraints.
  • Rejected -- the translation exceeds one or more constraints (width, height, or max lines).
  • Needs Review -- the check could not be executed due to missing or invalid metadata.

Each checked string also receives a comment with detailed measurement information.


Setting Up Metadata

To run the PBLC, you need to provide layout metadata on your strings using custom metadata fields prefixed with GLS_. These fields define the font, size, and bounding box for each string.

Mandatory Fields

The following fields are required for every string you want to check:

Metadata Field Description Example Value
GLS_FontName Google Fonts family name Roboto
GLS_FontSize Font size in pixels (must be > 0) 16
GLS_BoundingBoxWidth Maximum allowed width in pixels (must be > 0) 200

Optional Fields

These fields allow fine-grained control over the text rendering. If not provided, defaults are applied.

Metadata Field Description Default Valid Values
GLS_FontWeight Font weight 400 100-900 or names like bold, light, normal, etc
GLS_BoundingBoxHeight Maximum allowed height in pixels -- Any positive number
GLS_MaxLines Maximum number of lines before truncation -- Any positive integer
GLS_LetterSpacing Additional space between characters (px) 0 Any number (including negative)
GLS_WordSpacing Additional space between words (px) 0 Any number (including negative)
GLS_LineHeight Vertical distance between lines (multiplier) 1.0 Any positive number
GLS_TextTransform Text transformation -- uppercase, lowercase, capitalize
GLS_FontStyle Font style normal normal, italic, oblique
GLS_FontVariant Font variant normal normal, small-caps
GLS_Kerning Enable or disable kerning on on, off
GLS_WordWrap Word wrapping behavior normal normal, break-word

Note: If neither GLS_BoundingBoxHeight nor GLS_MaxLines is provided, only the width constraint is checked.


Running the Check

  1. In the Editor, select the strings you want to check by marking their checkboxes (1).
  2. Click the Actions button to open the multi-edit actions menu (2).
  3. Select Run Pixel-Based Length Check (3) and confirm it.

Running the Pixel-Based Length Check

  1. Wait for the check to complete. A loading indicator will be shown while the check is running.
  2. Once complete, each string will have an updated status and a comment with the results.

Understanding the Results

After the check runs, each string receives a status and a descriptive comment.

Accepted

The translation fits within all defined constraints.

Example comment:

[Pixel-Based Length Check] Text is 142px wide, which is within the max 200px.

Accepted result

Rejected

The translation exceeds one or more of the defined constraints.

Example comments:

[Pixel-Based Length Check] Text width (256px) exceeds max width (200px) by 56px.

[Pixel-Based Length Check] Text height (72px) exceeds max height (48px) by 24px.

[Pixel-Based Length Check] Text requires 4 lines but only 2 are allowed.

Rejected result

Needs Review

The check could not be executed. This happens when:

  • Mandatory metadata is missing -- e.g., no GLS_FontName or GLS_FontSize defined.
  • Metadata values are invalid -- e.g., font size is not a number, or a negative value is provided for a field that requires a positive number.
  • The font is not available on Google Fonts -- custom/local fonts are not supported in the current version.
  • An invalid font weight is specified -- e.g., 450 is not a standard weight.

Example comments:

[Pixel-Based Length Check] Missing mandatory metadata fields: GLS_FontName, GLS_FontSize

[Pixel-Based Length Check] Failed to fetch font 'MyCustomFont'. Currently only Google Fonts are supported.

[Pixel-Based Length Check] Invalid font weight: '450'. Must be one of: 100, 200, 300, 400, 500, 600, 700, 800, 900 or their names (e.g. bold, light).

Needs Review result

Back to Top