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 Font family name -- either a Google Fonts family, or the name of a font imported into the project's team (see Custom Fonts) 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 -- a variable custom font can cover the full range from a single file 400 100-900 or names like bold, light, normal, etc
GLS_FontWidth Font width (CSS font-stretch) -- a variable custom font can cover its full width range from a single file 100 50-200 or CSS keywords like condensed, expanded, 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.

Note: GLS_FontWeight and GLS_FontWidth can only be measured at a value the font actually provides. A variable font can be measured at any value its own wght/wdth axis covers, while a static font (and every Google Font, which always serves a single static file per request) can only be measured at a weight/width that font actually has a file for -- for width, one of the standard steps (50, 62.5, 75, 87.5, 100, 112.5, 125, 150, 200) -- there is no rounding to the nearest available value. A value the resolved font can't render is reported as Needs Review, naming the weights/widths that font does support. On Google Fonts, a weight or width is only available for families that publish it; the check reports an explicit error when the requested value isn't supported.

Custom Fonts

If your app uses a font that isn't available on Google Fonts, you can import it so the PBLC can measure text with it. Custom fonts are shared across every project owned by the same team -- import a font once and any of the team's projects can reference it by setting GLS_FontName to its family name.

You can manage custom fonts from either of these places:

  • Team Settings > Pixel-Based Length Check -- available whenever the feature is on your team's plan, independent of any single project's toggle.

  • Project Settings > General > Pixel-Based Length Check card -- once you've turned the check on for that project, the same font list and Import font action are shown there too, for convenience.

  • Supported formats: TTF and OTF, up to 50 MB per file. Variable fonts are supported -- a single variable font file can cover its full weight range (see GLS_FontWeight above) and its full width range (see GLS_FontWidth above) without a separate upload per weight or width.

  • Uploading a file with the same file name as one already in that family replaces it; a different file name adds it as an additional file in the family instead -- e.g. a Regular and a Bold file, a TTF and an OTF, or an upright and an italic file, all under the same family.

  • Each import or removal is recorded as a changelog event.

A team's own custom fonts take priority over a same-named Google Font -- set GLS_FontName to the custom font's name and it will be used automatically.

Note: If a family ends up with more than one file that could equally match a requested weight and style (e.g. a TTF and an OTF of the same weight), the same file is consistently used for that match.


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.

Preview Panel

Besides running the check in bulk from the Translations list, you can preview how a single translation fits its layout constraints directly while editing it.

  1. Focus a translation. If Pixel-Based Length Check is enabled for the project, a ruler icon button appears next to the comment button in the in-place editor.
  2. Click it to open the Pixel-Based Length Check panel.

Preview panel

The check runs automatically for the focused key and language, using the last saved value -- unsaved edits aren't validated until you save. The panel stays open as you move between keys, always tracking the currently focused entry.

The panel shows:

  • Status banner -- whether the check Passed, Exceeded the constraints, or Failed due to missing or unsupported metadata (same meaning as Accepted/Rejected/Needs Review below).
  • Issue detail -- when not passed, the specific reason (e.g. which bound was exceeded, or which metadata is missing/invalid).
  • View metadata constraints link -- opens the Details panel for this key, scrolled to its PBLC metadata fields. Since the full set of metadata only lives on the project's base language, viewing it from a target language first prompts you to switch.
  • Text preview -- a rendered image of the text inside its bounding box, styled with the resolved font -- a Google Font or an imported custom font -- size, and other metadata, so you can see exactly how (and where) it overflows, if at all. Right-to-left languages render accordingly.

If the entry has no saved text yet, the panel shows an empty state instead, since there's nothing to validate.


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 could not be resolved -- it isn't a custom font imported into the project's team (see Custom Fonts) and isn't a Google Font either.
  • 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 resolve font 'MyCustomFont'. It is neither a custom font imported into this team nor a Google Font.

[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