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

Question: How to generate a new TTF file from an existing TTF file, to have only the country flags? #30

Open
AndroidDeveloperLB opened this issue Sep 7, 2024 · 0 comments

Comments

@AndroidDeveloperLB
Copy link

Suppose I have a big font file (TTF file). I use this one by Mozilla:
https://github.com/mozilla/twemoji-colr/releases

I know I will need to use only a small subset of it, that's responsible of countries flags.
Not sure how country flags work in Unicode, but according to what I've found I think it's somehow from 0x1F1E6 to 0x1F1FF, and that the countries are just 2 of those combined. I don't know where are the results and how they are drawn. To me it seems that as 0x1F1E6 to 0x1F1FF are exactly a-z letters, it has to exist somewhere to show the countries flags themselves. Sadly I couldn't find a tool to show where those are.
So for now I've assumed something that I think is wrong, that I only need this range of glyphs.

Is there a way to make it smaller by removing the parts that I won't use, using this tool?
I thought maybe the command that was written in the main page could help me:

glyphhanger --subset=*.ttf

Not sure what it does, but I was hoping that maybe it makes multiple TTF files out of a TTF file that I provide, one for each glyphs groups, or something like that.

But before I even try, I need to install this tool...

I tried to use this command (used this tool):

npm install -g glyphhanger

But then I got these errors:

npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: this library is no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Use your platform's native atob() and btoa() methods instead
npm warn deprecated [email protected]: Use your platform's native DOMException instead
npm warn deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm warn deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm warn deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated [email protected]: < 22.8.2 is no longer supported
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     'C:\\Users\\User\\Desktop\\node-v20.17.0-win-x64\\node_modules\\glyphhanger\\node_modules',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\User\Desktop\node-v20.17.0-win-x64\node_modules\glyphhanger\node_modules\jsdom\lib'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\User\\Desktop\\node-v20.17.0-win-x64\\node_modules\\glyphhanger\\node_modules\\jsdom\\lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     'C:\\Users\\User\\Desktop\\node-v20.17.0-win-x64\\node_modules\\glyphhanger',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\User\Desktop\node-v20.17.0-win-x64\node_modules\glyphhanger\node_modules\jsdom'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\User\\Desktop\\node-v20.17.0-win-x64\\node_modules\\glyphhanger\\node_modules\\jsdom'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\User\Desktop\node-v20.17.0-win-x64\node_modules\glyphhanger\node_modules\puppeteer
npm error command failed
npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node install.js
npm error 'node' is not recognized as an internal or external command,
npm error operable program or batch file.
npm error A complete log of this run can be found in: C:\Users\User\AppData\Local\npm-cache\_logs\2024-09-07T21_42_17_598Z-debug-0.log

What should I do?

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

1 participant