mapbox / mapbox/mapbox-gl-js

Limit SDF dowscaling

Open
#7,652 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

Given the following style.json render test example:

{
  "version": 8,
  "metadata": {
    "test": { "height": 256, "width": 256 }
  },
  "center": [ 0, 0 ],
  "zoom": 0,
  "sources": {
    "point": {
      "type": "geojson",
      "data": {
        "type": "FeatureCollection",
        "features": [
          {
            "type": "Feature",
            "properties": { "name": "Napoli", "name_en": "Naples" },
            "geometry": {
              "type": "Point",
              "coordinates": [ 0, 0 ]
            }
          }
        ]
      }
    }
  },
  "glyphs": "local://glyphs/{fontstack}/{range}.pbf",
  "layers": [
    {
      "id": "text",
      "type": "symbol",
      "source": "point",
      "layout": {
        "text-field": ["format",
            ["get", "name_en"], { "font-scale": 48 },
            "Italy", { "font-scale": 16 } ,
            "\n", {},
            ["get", "name"], { "font-scale": 16, "text-font": ["literal", [ "NotoCJK" ]] }
        ],
        "text-font": [
          "Open Sans Semibold",
          "Arial Unicode MS Bold"
        ],
        "text-size": 1
      }
    }
  ]
}

In the example above, text-size is set to 1, while font-scale is set to different values. This generates downscaled SDF textures that produces unreadable results.

Rendered result:
actual

/cc @ansis @ChrisLoer

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the supplied style.json render test as the reproduction, focusing on text-size 1 and the differing font-scale values that generate downscaled SDF textures. Trace how this example produces unreadable glyphs; done means the rendered text remains readable without changing the requested font-scale behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.