Skip to content

feat(martin-core): Allow glyph ranges more than 0xFFFF#2438

Merged
CommanderStorm merged 17 commits intomaplibre:mainfrom
yutannihilation:fix/allow-sarrogate-codepoints
Jan 9, 2026
Merged

feat(martin-core): Allow glyph ranges more than 0xFFFF#2438
CommanderStorm merged 17 commits intomaplibre:mainfrom
yutannihilation:fix/allow-sarrogate-codepoints

Conversation

@yutannihilation
Copy link
Copy Markdown
Contributor

@yutannihilation yutannihilation commented Dec 20, 2025

Fix #2366

This pull request simply increases MAX_UNICODE_CP to 0x10FFFF
Resolves #2366.

The below is my rough understanding after reading https://en.wikipedia.org/wiki/Unicode_block. I think it's appropriate to include all of these.

  • U+0000 - U+FFFF is Basic Multilingual Plane, which covers characters for almost all modern languages
  • U+10000 - U+3347F covers minor characters such as historic scripts and emojis
  • U+E0000 - U+E01EF is for tags and variation selectors
  • U+F0000 - U+10FFFF is for private use (i.e. can be assigned arbitrary custom characters without worrying about possible conflict with the future standards)

The font files for testing contain only one glyph that the file name indicates. These are generated by https://github.com/yutannihilation/dummyfont, which I implemented with Codex. I'm not sure all the metadata is valid, but I believe this is good enough for testing purposes.

Copilot AI review requested due to automatic review settings December 20, 2025 14:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends Unicode glyph support from the Basic Multilingual Plane (U+0000 - U+FFFF) to the full Unicode range (U+0000 - U+10FFFF), enabling Martin to handle characters from supplementary planes including historic scripts, tags/variation selectors, and private use areas.

Key Changes:

  • Increased MAX_UNICODE_CP constant from 0xFFFF to 0x10FFFF
  • Added unit test to verify font processing for codepoints beyond the BMP
  • Added test font files containing glyphs for U+3320 and U+1F60A

Reviewed changes

Copilot reviewed 1 out of 3 changed files in this pull request and generated 1 comment.

File Description
martin-core/src/resources/fonts/mod.rs Updated MAX_UNICODE_CP constant to support full Unicode range up to U+10FFFF, improved documentation explaining the rationale, and added test for extended Unicode support
martin-core/src/resources/fonts/tests/u+3320.ttf Test font file containing a single glyph at U+3320 for validating support beyond the BMP
martin-core/src/resources/fonts/tests/u+1f60a.ttf Test font file containing a single glyph at U+1F60A (emoji range) for validating extended Unicode plane support

Copy link
Copy Markdown
Member

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thank you ❤️

I am going to bless the test output and this will be merged afterwards.

@CommanderStorm CommanderStorm enabled auto-merge (squash) December 20, 2025 16:48
auto-merge was automatically disabled December 21, 2025 02:12

Head branch was pushed to by a user without write access

@yutannihilation
Copy link
Copy Markdown
Contributor Author

Thanks for handling the test cases! It seems deploying lambda fails with this error:

Error: Container invocation failed due to maximum memory usage

I suspected 0x10FFFF might be too big for some value, but I don't find yet where it matters in actual...

@CommanderStorm
Copy link
Copy Markdown
Member

I think that the extra memory should be tiny.
A bit sus, but likly unrelated to your PR.

Let me try a few things

@CommanderStorm CommanderStorm enabled auto-merge (squash) December 21, 2025 03:40
@nyurik
Copy link
Copy Markdown
Member

nyurik commented Jan 9, 2026

i fixed this by adding MemorySize param. Note that I had to go from the default 128MB to 350MB - it was failing without that.

  MartinFunction:
    Type: 'AWS::Serverless::Function'
    Properties:
      Runtime: provided.al2023
      Layers:
        - Ref: MartinLayer
      CodeUri: lambda-function/
      Handler: config.yaml
+     MemorySize: 350

@CommanderStorm CommanderStorm merged commit 0f51421 into maplibre:main Jan 9, 2026
37 checks passed
@yutannihilation
Copy link
Copy Markdown
Contributor Author

Thanks! So, this actually increased memory usage a bit. Is it acceptable to you?

@yutannihilation yutannihilation deleted the fix/allow-sarrogate-codepoints branch January 9, 2026 22:52
@nyurik
Copy link
Copy Markdown
Member

nyurik commented Jan 9, 2026

@yutannihilation I don't think the code increased the memory - the font file did. In other words, each user of Martin on an AWS lambda has to configure how much RAM to allocate to that service, depending on their specific use case. 128MB is a very small (by today's standards) amount of RAM for a service, so if it uses a large font file, it simply won't fit within the allowed space.

@CommanderStorm CommanderStorm mentioned this pull request Jan 6, 2026
@yutannihilation
Copy link
Copy Markdown
Contributor Author

I see. Thanks for the explanation!

CommanderStorm added a commit that referenced this pull request Jan 28, 2026
## 🤖 New release

* `martin-tile-utils`: 0.6.8 -> 0.6.9 (✓ API compatible changes)
* `mbtiles`: 0.15.0 -> 0.15.1 (✓ API compatible changes)
* `martin-core`: 0.2.5 -> 0.2.6 (✓ API compatible changes)
* `martin`: 1.2.0 -> 1.3.0

<details><summary><i><b>Changelog</b></i></summary><p>


## `mbtiles`

<blockquote>

##
[0.15.1](mbtiles-v0.15.0...mbtiles-v0.15.1)
- 2026-01-27

### Added

- add MLT decoding support
([#2512](#2512))
- migrate our log library to tracing
([#2494](#2494))

### Other

- unignore `diff_and_patch_bsdiff` test with unique SQLite database
names ([#2480](#2480))
- *(mbtiles)* remove the prefix-ism around how files are named for
binary diff copy and simpify their naming
([#2478](#2478))
- *(mbtiles)* add assertion messages what we are checking to the copy
tests ([#2477](#2477))
</blockquote>

## `martin-core`

<blockquote>

##
[0.2.6](martin-core-v0.2.5...martin-core-v0.2.6)
- 2026-01-27

### Added

- migrate our log library to tracing
([#2494](#2494))
- *(martin-core)* Allow glyph ranges more than 0xFFFF
([#2438](#2438))

### Fixed

- *(perf)* Remove FontSources.masks as they were consuming large amounts
of memory even when no font sources were set
([#2519](#2519))
- improve error message if no SVG sprite files are present
([#2516](#2516))

### Other

- move our imports to tracing
([#2500](#2500))
- *(deps)* shear our dependencys
([#2497](#2497))
</blockquote>

## `martin`

<blockquote>

##
[1.3.0](martin-v1.2.0...martin-v1.3.0)
- 2026-01-27

### Added

- *(srv)* Add `route_prefix` configuration for native subpath support
without the need of a reverse proxy override
([#2523](#2523))
- add MLT decoding support
([#2512](#2512))
- migrate our log library to tracing
([#2494](#2494))
- improve martin-cp progress output time estimate
([#2491](#2491))
- *(pg)* include ID column info for tables
([#2485](#2485))
- *(pg)* support PostgreSQL materialized views
([#2279](#2279))
- *(martin-core)* Allow glyph ranges more than 0xFFFF
([#2438](#2438))

### Fixed

- *(ui)* clipboard copy for http://0.0.0.0:3000 and unify
implementations ([#2487](#2487))
- the `Copy` icon displaying nicely, next to the text and with enough
padding ot all items
([#2483](#2483))
- update copy text to include icon for better visibility
([#2482](#2482))
- *(perf)* Remove FontSources.masks as they were consuming large amounts
of memory even when no font sources were set
([#2519](#2519))
- improve error message if no SVG sprite files are present
([#2516](#2516))

### Other

- move our request logging to tracing
([#2508](#2508))
- move our imports to tracing
([#2500](#2500))
- *(deps)* shear our dependencys
([#2497](#2497))
- *(ui)* adjust margin for copy icon in URL component
([#2489](#2489))
- unignore `diff_and_patch_bsdiff` test with unique SQLite database
names ([#2480](#2480))
- *(mbtiles)* remove the prefix-ism around how files are named for
binary diff copy and simpify their naming
([#2478](#2478))
- *(mbtiles)* add assertion messages what we are checking to the copy
tests ([#2477](#2477))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serve glyph ranges beyond the Basic Multilingual Plane

4 participants