repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
python-fire
examples/diff/diff_test.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
96
2,676
python-fire
examples/cipher/cipher_test.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
35
1,174
python-fire
examples/cipher/cipher.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
60
1,668
python-fire
examples/widget/collector.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
39
1,127
python-fire
examples/widget/widget.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
36
976
python-fire
examples/widget/collector_test.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
40
1,190
python-fire
examples/widget/widget_test.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
37
1,081
python-fire
examples/identity/identity.py
.py
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
29
790
maple-font
task.py
.py
#!/usr/bin/env python3 from scripts.task import main if __name__ == "__main__": main()
7
93
maple-font
build.py
.py
#!/usr/bin/env python3 from scripts.pipeline import main if __name__ == "__main__": main()
7
97
maple-font
scripts/in_browser.py
.py
import io import json from zipfile import ZipFile from fontTools.ttLib import TTFont MOVING_RULES = ["ss03", "ss07", "ss08", "ss09", "ss10", "ss11"] def get_freeze_config_str(config): result = "" for k, v in sorted(config.items()): if v == "1": result += f"+{k};" if (v == "0" and...
126
4,276
maple-font
scripts/errors.py
.py
from __future__ import annotations from dataclasses import dataclass class BuildError(Exception): """Base class for actionable build-system failures.""" class BuildDependencyError(BuildError, RuntimeError): """Raised when a required local build dependency is unavailable.""" class CJKSourceUnavailable(Bui...
67
1,949
maple-font
scripts/feature/italic.py
.py
import scripts.feature.ast as ast from scripts.feature.base.clazz import base_class_list, cls_digit from scripts.feature.calt._infinite_utils import InfiniteOptions from scripts.feature.cv import ( cv01, cv02, cv03, cv04, cv05, cv06, cv07, cv08, cv09, cv10, cv11, cv12, ...
205
4,875
maple-font
scripts/feature/catalog.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from scripts.feature.cv import cv96, cv97, cv98, cv99 if TYPE_CHECKING: from scripts.feature import ast NORMAL_ENABLED_FEATURES = ( "cv01", "cv02", "cv33", "cv34", "cv35", "cv36", "cv61", "cv62", "ss05", ...
31
499
maple-font
scripts/feature/ast.py
.py
import re from collections.abc import Sequence from typing import Literal, TypeAlias class Line: __slots__ = ("level", "text") def __init__(self, text: str, level=0) -> None: self.text = text self.level = level def indent(self) -> "Line": return Line(self.text, self.level + 1 if ...
603
16,413
maple-font
scripts/feature/regular.py
.py
import scripts.feature.ast as ast from scripts.feature.base.clazz import base_class_list, cls_digit from scripts.feature.calt._infinite_utils import InfiniteOptions from scripts.feature.cv import ( cv01, cv02, cv03, cv04, cv05, cv06, cv07, cv08, cv09, cv10, cv11, cv12, ...
191
4,734
maple-font
scripts/feature/compiler.py
.py
import json import re from copy import deepcopy from html import escape from typing import cast from scripts.feature import ast from scripts.feature.base import get_base_feature_cn_only, get_base_features from scripts.feature.base.lang import get_lang_list from scripts.feature.calt import get_calt, get_calt_lookup fro...
292
8,297
maple-font
scripts/feature/apply.py
.py
from __future__ import annotations from copy import deepcopy from dataclasses import dataclass from io import StringIO from pathlib import Path from typing import TYPE_CHECKING, Any from fontTools.feaLib import ast as fea_ast from fontTools.feaLib.builder import addOpenTypeFeaturesFromString from fontTools.feaLib.par...
525
18,005
maple-font
scripts/feature/base/lang.py
.py
import scripts.feature.ast as ast def get_lang_list(): return [ ast.Line(""), ast.langsys("DFLT", "dflt"), ast.Line(""), ast.langsys("latn", "dflt"), ast.langsys("latn", "AZE"), ast.langsys("latn", "CRT"), ast.langsys("latn", "KAZ"), ast.langsys("lat...
19
482
maple-font
scripts/feature/base/locl.py
.py
import scripts.feature.ast as ast i_acc = ast.__subst("i", "idotaccent") locl_0 = ast.Lookup( "locl_latn_0", None, [ ast.script("latn"), ast.lang("AZE"), i_acc, ast.lang("CRT"), i_acc, ast.lang("KAZ"), i_acc, ast.lang("TAT"), i_acc, ...
180
3,647
maple-font
scripts/feature/base/number.py
.py
import scripts.feature.ast as ast _number_list = [ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", ] clazz_number = ast.cls(_number_list) clazz_numr = ast.cls([f"{n}.numr" for n in _number_list]) clazz_dnom = ast.cls([f"{n}.dnom" for n in _number_...
70
1,870
maple-font
scripts/feature/base/__init__.py
.py
import scripts.feature.ast as ast from scripts.feature.base.case import get_case_feature from scripts.feature.base.ccmp import get_ccmp_feature from scripts.feature.base.locl import get_locl_feature_list from scripts.feature.base.number import get_number_feature_list def get_base_features(calt: ast.Feature, is_cn: bo...
29
902
maple-font
scripts/feature/base/case.py
.py
import scripts.feature.ast as ast case_glyphs = [ "colon", "periodcentered.loclCAT", "dieresiscomb", "dotaccentcomb", "gravecomb", "acutecomb", "hungarumlautcomb", "circumflexcomb", "caroncomb", "brevecomb", "ringcomb", "tildecomb", "macroncomb", "hookabovecomb",...
57
1,067
maple-font
scripts/feature/base/clazz.py
.py
import scripts.feature.ast as ast cls_zero = ast.Clazz("Zero", ["zero", "zero.zero"]) cls_one = ast.Clazz("One", ["one", "one.cv04"]) cls_digit = ast.Clazz( "Digit", [ cls_zero, cls_one, "two", "three", "four", "five", "six", "seven", "eig...
317
6,132
maple-font
scripts/feature/base/ccmp.py
.py
import scripts.feature.ast as ast from scripts.feature.base.clazz import cls_uppercase comb_top_acc = ast.Clazz( "CombiningTopAccents", [ "acutecomb", "brevecomb", "caroncomb", "circumflexcomb", "commaturnedabovecomb", "dblgravecomb", "dieresiscomb", ...
191
4,430
maple-font
scripts/feature/cv/cv42.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_7 # https://github.com/subframe7536/maple-font/issues/549 def cv42_subst(): return [ ast.subst_map( GLYPHS_7, target_suffix=".cv42", ), ] cv42_name = "Alternative italic `7` with middle ba...
19
442
maple-font
scripts/feature/cv/cv45.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_U def cv45_subst(): return ast.subst_map(GLYPHS_U, target_suffix=".cv45") cv45_name = "Alternative italic `u` without tail" cv45_feat_italic = ast.CharacterVariant( id=45, desc=cv45_name, content=cv45_subst(), version="8.0", exa...
13
331
maple-font
scripts/feature/cv/cv97.py
.py
import scripts.feature.ast as ast def cv97_subst(): return ast.subst_map( "…", target_suffix=".full", ) cv97_name = "Full width ellipsis (`…`)" cv97_feat_cn = ast.CharacterVariant( id=97, desc=cv97_name, content=cv97_subst(), version="7.0", example="……" )
15
296
maple-font
scripts/feature/cv/cv33.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_I def cv33_subst(): def gen(*suffix_list: str): result: list[str] = [] for suf in suffix_list: result.append(ast.gly("il", suf)) result.append(ast.gly("ill", suf)) return result r...
32
749
maple-font
scripts/feature/cv/cv05.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_G # https://github.com/subframe7536/maple-font/issues/329 def cv05_subst(): return ast.subst_map( GLYPHS_G, target_suffix=".cv05", ) cv05_name = "Alternative `g` in double story style, no effect in italic style" ...
17
439
maple-font
scripts/feature/cv/cv37.py
.py
import scripts.feature.ast as ast def cv37_subst(): return ast.subst_map( [ "y", "yacute", "ycircumflex", "ydieresis", "ydotbelow", "ygrave", "yhookabove", "ymacron", "ytilde", "u-cy", ...
30
659
maple-font
scripts/feature/cv/cv68.py
.py
import scripts.feature.ast as ast def cv68_subst(): return ast.subst_map(["==="], target_suffix=".cv68") cv68_name = "Alternative `===` with 2 bars" cv68_feat = ast.CharacterVariant( id=68, desc=cv68_name, content=cv68_subst(), version="8.0", example="===" )
12
271
maple-font
scripts/feature/cv/cv44.py
.py
import scripts.feature.ast as ast def cv44_subst(): return [ *ast.subst_map(["f", ast.gly("ff")], target_suffix=".cv44"), *ast.subst_map( ["f", ast.gly("ff")], source_suffix=".cv32", target_suffix=".cv44" ), ] cv44_name = "Alternative Italic `f` with bottom bar" cv44_feat...
17
430
maple-font
scripts/feature/cv/cv43.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_Z_z # https://github.com/subframe7536/maple-font/issues/549 def cv43_subst(): return [ ast.subst_map( GLYPHS_Z_z, target_suffix=".cv43", ), ] cv43_name = "Alternative italic `Z` and `z` wi...
19
455
maple-font
scripts/feature/cv/cv67.py
.py
import scripts.feature.ast as ast def cv67_subst(): return [ ast.subst_map( [ "bar", "bar_bar.liga", "bar_bar_bar.liga", "underscore_bar_underscore.liga", "hyphen_bar.liga", "bar_hyphen.liga", ...
33
870
maple-font
scripts/feature/cv/cv98.py
.py
import scripts.feature.ast as ast def cv98_subst(): return ast.subst_map( "—", target_suffix=".full", ) cv98_name = "Full width emdash (`—`)" cv98_feat_cn = ast.CharacterVariant( id=98, desc=cv98_name, content=cv98_subst(), version="7.0", example="——" )
15
294
maple-font
scripts/feature/cv/cv07.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_J_UPPER # https://github.com/subframe7536/maple-font/issues/324 def cv07_subst(): return [ ast.subst_map( GLYPHS_J_UPPER, target_suffix=".cv07", ), ] cv07_name = "Alternative `J` without t...
19
474
maple-font
scripts/feature/cv/cv36.py
.py
import scripts.feature.ast as ast def cv36_subst(): return ast.subst_map( [ "x", "ha-cy", "hadescender-cy", "hahook-cy", "hastroke-cy", ast.gly("xl"), ast.gly("xl", ".cv04"), ast.gly("xl", ".cv35"), ], ...
24
544
maple-font
scripts/feature/cv/_common.py
.py
GLYPHS_A = [ "a", "aacute", "abreve", "abreveacute", "abrevedotbelow", "abrevegrave", "abrevehookabove", "abrevetilde", "acaron", "acircumflex", "acircumflexacute", "acircumflexdotbelow", "acircumflexgrave", "acircumflexhookabove", "acircumflextilde", "adi...
134
1,993
maple-font
scripts/feature/cv/cv31.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_A def cv31_subst(): return ast.subst_map( [ *GLYPHS_A, # Ligature variants ast.gly("al"), ast.gly("all"), ast.gly("al", ".cv04"), ast.gly("all", ".cv04"),...
23
540
maple-font
scripts/feature/cv/cv40.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_J_UPPER # https://github.com/subframe7536/maple-font/issues/324 def cv40_subst(): return [ ast.subst_map( GLYPHS_J_UPPER, target_suffix=".cv40", ), ] cv40_name = "Alternative italic `J` wi...
19
454
maple-font
scripts/feature/cv/cv63.py
.py
import scripts.feature.ast as ast def cv63_subst(): return [ ast.subst_map( "<=", target_suffix=".cv63", ), ] cv63_name = "Alternative `<=` in arrow style" cv63_feat = ast.CharacterVariant( id=63, desc=cv63_name, content=cv63_subst(), version="7.1", example="<=" )...
17
321
maple-font
scripts/feature/cv/cv02.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_A def cv02_subst(): return ast.subst_map( GLYPHS_A, target_suffix=".cv02", ) cv02_name = "Alternative `a` with top arm, no effect in italic style" cv02_feat_regular = ast.CharacterVariant( id=2, desc=cv02_nam...
16
374
maple-font
scripts/feature/cv/cv61.py
.py
import scripts.feature.ast as ast # https://github.com/subframe7536/maple-font/issues/348 def cv61_subst(): return ast.subst_map( [",", ";", ";;", ";;;", "questiongreek"], target_suffix=".cv61", ) cv61_name = "Alternative `,` and `;` with straight tail" cv61_feat = ast.CharacterVariant( ...
16
395
maple-font
scripts/feature/cv/cv62.py
.py
import scripts.feature.ast as ast # https://github.com/subframe7536/maple-font/issues/348 def cv62_subst(): return ast.subst_map( ["?", "questiondown", "??", "???", "?:", ":?", ":?>", "?.", ".?", "#?"], target_suffix=".cv62", ) cv62_name = "Alternative `?` with larger openings" cv62_feat = a...
16
419
maple-font
scripts/feature/cv/cv03.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_I def cv03_subst(): return ast.subst_map( GLYPHS_I, target_suffix=".cv03", ) cv03_name = "Alternative `i` without left bottom bar" cv03_feat_regular = ast.CharacterVariant( id=3, desc=cv03_name, content=cv03_...
16
358
maple-font
scripts/feature/cv/cv38.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_G # https://github.com/subframe7536/maple-font/issues/329 def cv38_subst(): return ast.subst_map( GLYPHS_G, target_suffix=".cv38", ) cv38_name = "Alternative italic `g` in double story style" cv38_feat_italic = a...
17
419
maple-font
scripts/feature/cv/cv64.py
.py
import scripts.feature.ast as ast def cv64_subst(): return [ ast.subst_map( ["<=", ">="], target_suffix=".cv64", ), ] cv64_name = "Alternative `<=` and `>=` with horizen bottom bar" cv64_feat = ast.CharacterVariant( id=64, desc=cv64_name, content=cv64_subst(), ver...
17
347
maple-font
scripts/feature/cv/cv41.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_R # https://github.com/subframe7536/maple-font/issues/328 def cv41_subst(): return [ ast.subst_map( GLYPHS_R, target_suffix=".cv41", ), ] cv41_name = "Alternative italic `r` with bottom ba...
19
442
maple-font
scripts/feature/cv/cv10.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_Z_z # https://github.com/subframe7536/maple-font/issues/549 def cv10_subst(): return [ ast.subst_map( GLYPHS_Z_z, target_suffix=".cv10", ), ] cv10_name = "Alternative `Z` and `z` with midd...
19
476
maple-font
scripts/feature/cv/cv08.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_R # https://github.com/subframe7536/maple-font/issues/328 def cv08_subst(): return [ ast.subst_map( GLYPHS_R, target_suffix=".cv08", ), ] cv08_name = "Alternative `r` with bottom bar, no e...
19
462
maple-font
scripts/feature/cv/cv96.py
.py
import scripts.feature.ast as ast def cv96_subst(): return ast.subst_map( [ "“", "”", "‘", "’", ], target_suffix=".full", ) cv96_name = "Full width quotes (`“` / `”` / `‘` / `’`)" cv96_feat_cn = ast.CharacterVariant( id=96, desc=cv9...
20
406
maple-font
scripts/feature/cv/cv34.py
.py
import scripts.feature.ast as ast def cv34_subst(): return ast.subst_map(["k", "kcommaaccent"], target_suffix=".cv34") cv34_name = "Alternative Italic `k` without center circle" cv34_feat_italic = ast.CharacterVariant( id=34, desc=cv34_name, content=cv34_subst(), version="7.0", example="k" )
12
305
maple-font
scripts/feature/cv/cv66.py
.py
import scripts.feature.ast as ast def cv66_subst(): return [ ast.subst_map( ["||>", "<||", "<|", "|>", "<|>", "|||>", "<|||"], target_suffix=".cv66", ), ] cv66_name = "Alternative pipe arrows" cv66_feat = ast.CharacterVariant( id=66, desc=cv66_name, content=cv66_s...
17
358
maple-font
scripts/feature/cv/cv32.py
.py
import scripts.feature.ast as ast def cv32_subst(): return ast.subst_map(["f", ast.gly("ff")], target_suffix=".cv32") cv32_name = "Alternative Italic `f` without bottom tail" cv32_feat_italic = ast.CharacterVariant( id=32, desc=cv32_name, content=cv32_subst(), version="7.0", example="f" )
12
302
maple-font
scripts/feature/cv/cv01.py
.py
import scripts.feature.ast as ast from scripts.feature.calt._infinite_utils import InfiniteOptions _DEFAULT_INFINITE_OPTIONS = InfiniteOptions() sfx = ".cv01" def cv01_subst(options: InfiniteOptions): return [ ast.subst_map( "$", target_suffix=sfx, ), ast.subst_ma...
71
1,786
maple-font
scripts/feature/cv/cv09.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_7 # https://github.com/subframe7536/maple-font/issues/549 def cv09_subst(): return [ ast.subst_map( GLYPHS_7, target_suffix=".cv09", ), ] cv09_name = "Alternative `7` with middle bar, no e...
19
462
maple-font
scripts/feature/cv/cv99.py
.py
import scripts.feature.ast as ast from scripts.feature.base.locl import lookup_TW def cv99_subst(): return [lookup_TW.use()] cv99_name = "Traditional centered punctuations" cv99_feat_cn = ast.CharacterVariant( id=99, desc=cv99_name, content=cv99_subst(), version="7.0", example=",。" )
13
301
maple-font
scripts/feature/cv/cv12.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_U def cv12_subst(): return ast.subst_map(GLYPHS_U, target_suffix=".cv12") cv12_name = "Alternative `u` without tail, no effect in italic style" cv12_feat_regular = ast.CharacterVariant( id=12, desc=cv12_name, content=cv12_subst(...
13
352
maple-font
scripts/feature/cv/cv39.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_I # https://github.com/subframe7536/maple-font/issues/324 def cv39_subst(): def gen(*suffix_list: str): result: list[str] = [] for suf in suffix_list: result.append(ast.gly("il", suf)) result.a...
37
920
maple-font
scripts/feature/cv/cv04.py
.py
from scripts.feature import ast from scripts.feature.cv._common import GLYPHS_1, GLYPHS_L def cv04_subst_regular(): return ast.subst_map( GLYPHS_L + GLYPHS_1, target_suffix=".cv04", ) def cv04_subst_italic(): return ast.subst_map( [ *GLYPHS_L, *GLYPHS_1, ...
42
1,089
maple-font
scripts/feature/cv/cv11.py
.py
import scripts.feature.ast as ast def cv11_subst(): return ast.subst_map(["f"], target_suffix=".cv11") cv11_name = "Alternative `f` with bottom bar, no effect in italic style" cv11_feat_regular = ast.CharacterVariant( id=11, desc=cv11_name, content=cv11_subst(), version="7.7", example="f" )
12
304
maple-font
scripts/feature/cv/cv65.py
.py
import scripts.feature.ast as ast def cv65_subst(): glyphs = ["&", "&&", "&&&"] return [ ast.subst_map( glyphs, target_suffix=".cv65", ), ast.subst_map( glyphs, source_suffix=".cv01", target_suffix=".cv65", ), ] ...
23
483
maple-font
scripts/feature/cv/cv06.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_I # https://github.com/subframe7536/maple-font/issues/324 def cv06_subst(): return [ ast.subst_map( GLYPHS_I, target_suffix=".cv06", ), ast.subst_map( GLYPHS_I, s...
24
591
maple-font
scripts/feature/cv/cv35.py
.py
import scripts.feature.ast as ast from scripts.feature.cv._common import GLYPHS_1, GLYPHS_L def cv35_subst(): base_glyphs = [ *[g for g in GLYPHS_L if g != "lslash"], ast.gly("Cl"), ast.gly("al"), ast.gly("cl"), ast.gly("el"), ast.gly("il"), ast.gly("ll"), ...
65
1,614
maple-font
scripts/feature/ss/ss13.py
.py
import scripts.feature.ast as ast from scripts.feature.base.locl import lookup_CY_SRB, lookup_CY_SRB_ITALIC def ss13_feat(italic: bool): lookup = lookup_CY_SRB_ITALIC if italic else lookup_CY_SRB return ast.StylisticSet( id=13, desc="Serbian Cyrillic forms", content=lookup.use(), ...
14
366
maple-font
scripts/feature/ss/ss10.py
.py
import scripts.feature.ast as ast def ss10_subst(): return [ ast.subst_liga( "=~", target=ast.gly("=~", ".ss10"), ign_prefix=ast.cls("~", "<", ">", ":", "="), ign_suffix=ast.cls("~", "=", ">"), ), ast.subst_liga( "!~", ...
27
659
maple-font
scripts/feature/ss/ss11.py
.py
from scripts.feature import ast def ss11_subst(): cls_ign_equal = ast.Clazz("IgnoreEqual", [">", "=", ":"]) ampersand_cv01 = ast.gly("&", ".cv01") question_cv62 = ast.gly("?", ".cv62") ampersand_cv65 = ast.gly("&", ".cv65") return [ ast.cls_states(cls_ign_equal), ast.Lookup( ...
134
4,163
maple-font
scripts/feature/ss/ss09.py
.py
import scripts.feature.ast as ast # https://github.com/subframe7536/maple-font/issues/352 def ss09_subst(): return ast.subst_liga( "~=", # Lua target=ast.gly("~=", ".ss09"), ign_prefix=ast.cls("~", "<", "="), ign_suffix=ast.cls("~", "=", ">", "<", ":"), ) ss09_name = "Asciit...
18
472
maple-font
scripts/feature/ss/ss04.py
.py
from scripts.feature import ast def ss04_subst(): return ast.subst_map( [ "__", "#__", ], target_suffix=".ss04", ) ss04_name = "Broken multiple underscores ligatures (`__`, `#__`)" ss04_feat = ast.StylisticSet( id=4, desc=ss04_name, content=ss04_subst(), v...
18
349
maple-font
scripts/feature/ss/ss03.py
.py
from scripts.feature import ast from scripts.feature.calt.tag import built_in_tag_text def ss03_subst(): # There are many classes for letters, allows to use letters in any case # e.g. `@I @N @F @O` matches: # - INFO # - INFo # - INfO # - INfo # - InFO # - InFo # - Inf...
42
976
maple-font
scripts/feature/ss/ss02.py
.py
from scripts.feature import ast def ss02_subst(): return ast.subst_map( [ "<=", ">=", ], target_suffix=".ss02", ) ss02_name = "Broken compare and equal ligatures (`<=`, `>=`)" ss02_feat = ast.StylisticSet( id=2, desc=ss02_name, content=ss02_subst(), versio...
18
344
maple-font
scripts/feature/ss/ss07.py
.py
from scripts.feature import ast def ss07_subst(): return [ ast.subst_liga( ">>", lookup_name=f"relax_{ast.gly('>>')}", ign_prefix=ast.cls(">", "/", "<"), ign_suffix=">", ), ast.subst_liga( ">>>", lookup_name=f"relax_{a...
25
604
maple-font
scripts/feature/ss/ss05.py
.py
from scripts.feature import ast def ss05_subst(): return [ast.subst_map("\\", source_suffix=".liga")] ss05_name = 'Revert thin backslash in escape symbols (`\\\\`, `\\"`, `\\.` ...)' ss05_feat = ast.StylisticSet( id=5, desc=ss05_name, content=ss05_subst(), version="7.0", example="\\\\" )
12
301
maple-font
scripts/feature/ss/ss08.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_question def ss08_subst(): return [ ast.subst_liga( "<<-", target=ast.gly("<<-", ".ss08"), ign_prefix=ast.cls("<", "-"), ign_suffix=ast.cls("<", ">", "-"), extra_rules=[ ...
114
3,609
maple-font
scripts/feature/ss/ss12.py
.py
import scripts.feature.ast as ast from scripts.feature.base.locl import lookup_CY_BGR, lookup_CY_BGR_ITALIC def ss12_feat(italic: bool): lookup = lookup_CY_BGR_ITALIC if italic else lookup_CY_BGR return ast.StylisticSet( id=12, desc="Bulgarian Cyrillic forms", content=lookup.use(), ...
14
372
maple-font
scripts/feature/ss/ss01.py
.py
from scripts.feature import ast def ss01_subst(): return ast.subst_map( [ "==", "===", "!=", "!==", "=/=", ], target_suffix=".ss01", ) ss01_name = "Broken multiple equals ligatures (`==`, `===`, `!=`, `!==` ...)" ss01_feat =...
21
417
maple-font
scripts/feature/ss/ss06.py
.py
from scripts.feature import ast def ss06_subst(): # Only handle glyphs that contains: # - default letter & default `l` # - default `ll` # - `ff` # - `tt` return ast.subst_map( [ ast.gly("Cl"), ast.gly("al"), ast.gly("cl"), ast.gly("el"), ...
42
1,090
maple-font
scripts/feature/calt/italic.py
.py
from scripts.feature import ast def get_lookup(): return [ ast.subst_liga("Cl", desc="italic Cl", ign_suffix="l"), ast.subst_liga("al", desc="italic al", ign_suffix="l"), ast.subst_liga("cl", desc="italic cl", ign_suffix="l"), ast.subst_liga("el", desc="italic el", ign_suffix="l"),...
38
1,369
maple-font
scripts/feature/calt/cross.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_digit, cls_zero def get_lookup(cls_hex_letter: ast.Clazz): return [ # Upper x for HEX numbers and width-height expression ast.Lookup( "cross", "0xA12 0x56 1920x1080", [ as...
19
527
maple-font
scripts/feature/calt/asciitilde.py
.py
from scripts.feature import ast def get_lookup(): start = ast.gly_seq("~", "sta") mid = ast.gly_seq("~", "mid") end = ast.gly_seq("~", "end") return [ ast.subst_liga( "<~", ign_prefix="<", ign_suffix=ast.cls("~", ">"), ), ast.subst_liga( ...
64
1,550
maple-font
scripts/feature/calt/__init__.py
.py
from scripts.feature import ast from scripts.feature.calt import ( asciitilde, cross, equal_arrow, escape, hyphen_arrow, italic, markup_like, pipe, tag, whitespace, ) from scripts.feature.calt._infinite_utils import InfiniteOptions _DEFAULT_INFINITE_OPTIONS = InfiniteOptions() ...
70
1,733
maple-font
scripts/feature/calt/equal_arrow.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_question from scripts.feature.calt._infinite_utils import InfiniteOptions, infinite_rules # Inspired by Fira Code, source: # https://github.com/tonsky/FiraCode/blob/master/features/calt/equal_arrows.fea def infinite_equals(options: InfiniteOpt...
237
8,177
maple-font
scripts/feature/calt/markup_like.py
.py
from scripts.feature import ast def get_lookup(): return [ ast.subst_liga( "<>", ign_prefix="<", ign_suffix=">", ), ast.subst_liga( "</", ign_prefix="<", ign_suffix=ast.cls("/", ">"), ), ast.subst_liga(...
57
1,248
maple-font
scripts/feature/calt/pipe.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_comma def get_lookup(): return [ ast.subst_liga( "<|||", ign_prefix="<", ign_suffix=ast.cls("|", ">"), ), ast.subst_liga( "|||>", ign_prefix="|", ...
48
1,114
maple-font
scripts/feature/calt/hyphen_arrow.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_digit, cls_question from scripts.feature.calt._infinite_utils import InfiniteOptions, infinite_rules # Inspirde by Fira Code, source: # https://github.com/tonsky/FiraCode/blob/master/features/calt/hyphen_arrows.fea def infinite_hyphens(cls_var...
200
6,904
maple-font
scripts/feature/calt/tag.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_comma, cls_space from scripts.utils.logging import logger built_in_tag_text = [ "trace", "debug", "info", "warn", "error", "fatal", "todo", "fixme", "note", "hack", "mark", "eror", "warning", ...
301
9,490
maple-font
scripts/feature/calt/_infinite_utils.py
.py
from dataclasses import dataclass from typing import TypeVar import scripts.feature.ast as ast _T = TypeVar("_T") @dataclass(frozen=True) class InfiniteOptions: enabled: bool = True def ignore_when_enabled(self, *items: _T) -> list[_T]: if self.enabled: return [] return list(ite...
57
1,494
maple-font
scripts/feature/calt/escape.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_question def get_lookup(): escape_cls = ast.Clazz( "Escape", # Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_escape [ "^", "$", ...
44
1,063
maple-font
scripts/feature/calt/whitespace/numbersign_underscore.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_question def get_lookup(): start = ast.gly_seq("#", "sta") mid = ast.gly_seq("#", "mid") end = ast.gly_seq("#", "end") return [ ast.subst_liga( "__", ign_prefix=ast.cls("_", "#"), ign...
79
1,901
maple-font
scripts/feature/calt/whitespace/brace.py
.py
from scripts.feature import ast def get_lookup(): left_start = ast.gly_seq("{", "sta") left_end = ast.gly_seq("{", "end") right_start = ast.gly_seq("}", "sta") right_end = ast.gly_seq("}", "end") return [ ast.Lookup( ast.gly("{{"), "{{", [ ...
57
1,518
maple-font
scripts/feature/calt/whitespace/upper.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_digit, cls_uppercase def get_lookup(): dbls = "germandbls" dbls_calt = f"{dbls}.calt" return [ ast.Lookup( "uppercase_colon", None, [ ast.subst( ast.cl...
30
780
maple-font
scripts/feature/calt/whitespace/__init__.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_question from scripts.feature.calt._infinite_utils import InfiniteOptions from scripts.feature.calt.whitespace import ( brace, colon, multiple_compare, numbersign_underscore, upper, ) def get_base_lookup(): return [ ...
154
4,039
maple-font
scripts/feature/calt/whitespace/colon.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_question from scripts.feature.calt._infinite_utils import InfiniteOptions def get_lookup(options: InfiniteOptions): cls_ign_colon = ast.Clazz("IgnoreColon", ["<", ":", ">", "="]) cls_ign_markup = ast.Clazz("IgnoreMarkup", ["<", "/", ">...
123
3,515
maple-font
scripts/feature/calt/whitespace/multiple_compare.py
.py
from scripts.feature import ast from scripts.feature.base.clazz import cls_digit, cls_space def get_lookup(cls_var: ast.Clazz): cls_leading_symbol_liga = ast.Clazz("LeadingSymbolLiga", ["++", "--", "__"]) cls_equal_hyphen = ast.Clazz("EqualHyphen", ["=", "-"]) cls_symbol_before_greater = ast.Clazz( ...
60
1,878
maple-font
scripts/cjk/presets.py
.py
from __future__ import annotations from dataclasses import dataclass from pathlib import Path from typing import TYPE_CHECKING, Literal from scripts.cjk.resolver import config_from_json if TYPE_CHECKING: from scripts.cjk.config import CJKBuildConfig CJKPresetId = Literal["cn", "jp", "tc", "kr"] DEFAULT_PRESET_R...
75
1,748
maple-font
scripts/cjk/static.py
.py
from __future__ import annotations from copy import deepcopy from pathlib import Path from typing import TYPE_CHECKING, cast from fontTools.ttLib.tables._m_e_t_a import table__m_e_t_a from scripts.feature.apply import apply_binary_features from scripts.feature.catalog import CJK_FEATURES from scripts.font_ops.glyph_...
265
8,646
maple-font
scripts/cjk/builder.py
.py
#!/usr/bin/env python3 from __future__ import annotations import threading from dataclasses import dataclass from io import BytesIO from os import cpu_count, makedirs from pathlib import Path from typing import TYPE_CHECKING, Any, ClassVar, Literal, TypeVar, cast from fontTools.misc.transform import Transform from fo...
1,438
49,939
maple-font
scripts/cjk/variable.py
.py
#!/usr/bin/env python3 from __future__ import annotations import math from copy import deepcopy from pathlib import Path from typing import TYPE_CHECKING, Any, cast from fontTools.ttLib.tables._g_l_y_f import GlyphCoordinates from fontTools.ttLib.tables.TupleVariation import TupleVariation from fontTools.varLib.insta...
542
18,318
maple-font
scripts/cjk/config.py
.py
from __future__ import annotations from dataclasses import dataclass, field from pathlib import Path from typing import Literal UnicodePreset = Literal["cn", "jp", "tc", "kr"] CJK_MASTER_WEIGHTS = (100, 400, 800) CJKMasterLocations = dict[int, dict[str, float]] DEFAULT_MAPLE_HHEA_METRICS: dict[str, int] = { "asc...
199
5,216