forked from parlr/ruby-font-creator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
189 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from fontTools.ttLib import TTFont | ||
|
||
def list_glyphs(font_path): | ||
# Open the font file | ||
font = TTFont(font_path) | ||
|
||
# Get the 'glyf' table, which contains the glyphs | ||
glyf_table = font['glyf'] | ||
|
||
# List all glyph names | ||
glyph_names = glyf_table.keys() | ||
|
||
# Print the glyph names | ||
for glyph_name in glyph_names: | ||
print(glyph_name) | ||
|
||
if __name__ == "__main__": | ||
font_path = "resources/fonts/Mengshen-Handwritten.ttf" # Replace with your font file path | ||
list_glyphs(font_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
Should contains fonts to use (also need by travis). | ||
|
||
Vietnamese font ranges | ||
- C0 Controls and Basic Latin: U+0000-U+0000 | ||
- C1 Controls and Latin-1 Supplement: U+0080-U+00FF | ||
- Latin Extended-A: U+0100-U+017F | ||
- Latin Extended-B: U+0180-U+024F | ||
- Combining Diacritical Marks: U+0300-U+036F |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"canvas": { | ||
"width": 80, | ||
"height": 80 | ||
}, | ||
"baseFontFilepath": "C:\\Users\\ITFDL\\OneDrive - FPT Corporation\\Personal\\Playground\\ruby-font-creator\\resources\\fonts\\NotoSansSC-Regular.ttf", | ||
"rubyFontFilepath": "C:\\Users\\ITFDL\\OneDrive - FPT Corporation\\Personal\\Playground\\ruby-font-creator\\resources\\fonts\\LXGWWenKaiMono-Regular.ttf", | ||
"fontName": "Catus-Pinyin-Bottom-Sans", | ||
"layout": { | ||
"base": { | ||
"x": 40, | ||
"y": 64, | ||
"fontSize": 56, | ||
"anchor": "bottom center", | ||
"attributes": { | ||
"fill": "black", | ||
"stroke": "black", | ||
"id": "glyph" | ||
} | ||
}, | ||
"ruby": { | ||
"x": 40, | ||
"y": 86, | ||
"fontSize": 28, | ||
"anchor": "bottom center", | ||
"attributes": { | ||
"fill": "black", | ||
"stroke": "black", | ||
"id": "ruby" | ||
} | ||
} | ||
}, | ||
"dataSource": "C:\\Users\\ITFDL\\OneDrive - FPT Corporation\\Personal\\Playground\\ruby-font-creator\\src\\data-small-org.json", | ||
"formats": [ | ||
"ttf" | ||
], | ||
"inputFiles": "./build/**/*.svg", | ||
"workingDir": "C:\\Users\\ITFDL\\OneDrive - FPT Corporation\\Personal\\Playground\\ruby-font-creator\\build\\svg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pyftmerge "../output/Tigris-Pinyin-Top-Handwritten.ttf" "../output/Pinyin-Test-Bottom-Small.ttf" --output-file=merged.ttf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import argparse | ||
from fontTools.ttLib import TTFont | ||
from fontTools.merge import Merger | ||
|
||
def merge_fonts(output, input1, input2): | ||
# Merge the fonts using file paths (not TTFont objects) | ||
merger = Merger() | ||
new_font = merger.merge([input1, input2]) | ||
|
||
# Save the merged font to the specified output path | ||
new_font.save(output) | ||
|
||
def main(): | ||
# Set up the argument parser | ||
parser = argparse.ArgumentParser(description="Merge two font files into one.") | ||
|
||
# Add arguments for input and output files | ||
parser.add_argument('input1', metavar='input1', type=str, | ||
help="Path to the first font file (input1).") | ||
parser.add_argument('input2', metavar='input2', type=str, | ||
help="Path to the second font file (input2).") | ||
parser.add_argument('output', metavar='output', type=str, | ||
help="Path to save the merged font file (output).") | ||
|
||
# Parse the arguments | ||
args = parser.parse_args() | ||
|
||
# Call the merge_fonts function with the parsed arguments | ||
merge_fonts(args.output, args.input1, args.input2) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pyftsubset "C:\Users\ITFDL\OneDrive - FPT Corporation\Personal\Playground\ruby-font-creator\resources\fonts\NotoSerifSC-Regular.ttf" --unicodes="U+0000-007F" --unicodes="U+0080-00FF" --unicodes="U+0100-017F" --unicodes="U+0180-024F" --unicodes="U+0300-036F" --output-file=subset1.ttf | ||
|