Skip to content

Add country flags#136

Closed
kijeEnki wants to merge 1 commit into
typst:mainfrom
kijeEnki:main
Closed

Add country flags#136
kijeEnki wants to merge 1 commit into
typst:mainfrom
kijeEnki:main

Conversation

@kijeEnki

Copy link
Copy Markdown

[I think the title and the commit describe enough.]

@MDLC01

MDLC01 commented Dec 27, 2025

Copy link
Copy Markdown
Collaborator

If this is indeed the interface we want to provide to the end user, we may want to generate the variants automatically from a list of country codes instead of hardcoding them.

If instead we hardcode all codes like in this pull request, I wouldn't feel confident merging it unless we add a test that makes sure all flag.xy variants correspond to the right flag (i.e., the value of flag.xy is the sequence REGIONAL INDICATOR SYMBOL LETTER x + REGIONAL INDICATOR SYMBOL LETTER y).

@MDLC01 MDLC01 added the waiting on reviews Breaking and non-breaking changes need respectively 3 and 2 reviews label Dec 27, 2025
@kijeEnki

Copy link
Copy Markdown
Author

@MDLC01 i have generated the ascii codes by subtracting a value from regional indicators. i can assure you all of them are correct. checking those, however, might be a good idea

@T0mstone

Copy link
Copy Markdown
Collaborator

Having it explicitly in the module source and having a test that runs an automatic check is indeed the way it should be done, and already has precedence with the variation selectors.

@Enivex

Enivex commented Dec 28, 2025

Copy link
Copy Markdown
Collaborator

Something like \ri{x} meaning U+1F1FD : REGIONAL INDICATOR SYMBOL LETTER X ?

That way flag.us can be \ri{u} \ri{s}

@MDLC01

MDLC01 commented Dec 28, 2025

Copy link
Copy Markdown
Collaborator

This is also a possibility but it would be much more verbose, and still annoying to check manually. I think a test would be better.

@Enivex

Enivex commented Dec 28, 2025

Copy link
Copy Markdown
Collaborator

This is also a possibility but it would be much more verbose, and still annoying to check manually. I think a test would be better.

I was thinking both.

That being said, isn't there some crate we can use as a source of truth about valid regional sequences? To avoid having to hard code everything.

@kijeEnki

Copy link
Copy Markdown
Author

@MDLC01

MDLC01 commented Dec 31, 2025

Copy link
Copy Markdown
Collaborator

Interesting, I did not think Unicode provided an almost exhaustive list of flag sequences. Then I think it would be better to generate the flag variants automatically based on that.

@MDLC01

MDLC01 commented Jan 24, 2026

Copy link
Copy Markdown
Collaborator

Actually, the better way of doing it would be to have the flags be hard-coded but have a test that ensures all flags are valid, and all valid flags are present. This is consistent with the approach taken in #126 and it means we can keep Codex build-dependency-free.

@MDLC01 MDLC01 added waiting on author This is waiting on an action by the author and removed waiting on reviews Breaking and non-breaking changes need respectively 3 and 2 reviews labels Jan 24, 2026
@MDLC01

MDLC01 commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

@kijeEnki are you planning to continue working on this PR soon? No worries if not, but then I'll close it for now to reduce the amount of open PRs.

@kijeEnki

Copy link
Copy Markdown
Author

i am not. i thought we decided to let the typst team introduce a test for each flag to exist.

@MDLC01

MDLC01 commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Okay, thanks anyway

@MDLC01 MDLC01 closed this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting on author This is waiting on an action by the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants