Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional glyphs #227

Open
Carifio24 opened this issue Feb 3, 2023 · 3 comments
Open

Add additional glyphs #227

Carifio24 opened this issue Feb 3, 2023 · 3 comments

Comments

@Carifio24
Copy link
Member

While trying to add some N/S/E/W direction labels to a CosmicDS WWT interactive, I discovered that I couldn't do it via the same mechanism as e.g. the constellation names because the set of glyphs doesn't include a W. In particular, there are a few letters missing: see the XML asset, or the associated image.

Based on the image, it looks like glyphs were added on an ad-hoc basis (you can see some month names in there), which would explain the missing letters. I don't remember exactly where this file lives, but if it's not too involved, I think it would be nice to fill out the rest of the alphabet (both cases), and add in any other glyphs that might see common use (e.g. a colon).

@pkgw
Copy link
Contributor

pkgw commented Feb 4, 2023

Yeah, having all of the letters seems like a pretty reasonable goal! My guess is that only a limited subset of letters were added to keep the glyph image size reasonable; it's currently 2048x2048, and to include a full alphabet and symbols would make it a lot bigger.

To provide access to a full alphabet maybe it would make sense to spread the symbols across multiple images, roughly grouped by frequency of usage.

To actually update these assets, it might be good to create a little Python script that can take an OpenType/TrueType font file and using some font-rasterization magic to output the data files. It would be a bit of a hassle to set up, but I don't see any massively easier approach, and it would be nice to be able to update these assets sustainably.

@Carifio24
Copy link
Member Author

Just to keep a record for posterity:

I used https://www.whatfontis.com/ to identify the font from the glyphs, and its top hit was Microsoft Sans Serif. This both passes the eye test for me and just makes sense as what would've been used. I've got a TTF for it, so generating the glyph images via a script is something I can tinker with.

@Carifio24
Copy link
Member Author

I was looking through my open issues tonight and saw this, and decided to give it another look. By looking at the image and the values in the XML, I was able to figure out the setup. I've now got a Python script that uses ImageMagick bindings that can generate image and XML files for whatever characters we want.

Trying out these files with the engine works well. However, the glyphs that my script generates aren't exactly the same as the ones we have - in particular, the glyphs seem to have a slightly different aspect ratio. I'm not sure what the cause is - maybe it's something about how I'm generating the file, or maybe the TTF I have isn't actually the same font as the current glyphs use.

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

No branches or pull requests

2 participants