Git Product home page Git Product logo

fontfreeze's Introduction

Mu-Tsun Tsai 蔡牧村

Hello, I'm a full stack developer from Taiwan 🇹🇼. I've been coding for 30 years and I'm a big fan of open source projects. I am also an origami artist as well as an origami design theory scientist.

fontfreeze's People

Contributors

mutsuntsai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fontfreeze's Issues

[Feature] Actual glyph substitution

This is related to issue #1 that OpenType features are not natively supported in some environments such as Notepad++. For maximal compatibility, we should substitute the actual glyph if the feature being activated involves just a single character. I guess I will make that as an option which is on by default.

Suggestion: Read the font family from the font

Currently we can only use 4 font styles with this tool: Regular, Italic, Bold, Bold Italic.

It would be good if the tool could just read the font style from the uploaded font instead of having the user to select one of the four.

This is not that critically as I'm currently fine with the default ones but there are many fonts like Cascadia Code/Mono and JetBrains Mono that have different styles like Light, Semi Bold etc..

Feature request: possibility of baking in line height

Use-case: If you customize fonts like Input you'd find that they let you bake in line height as well. This is useful in the cases where modifying line height in an app has an odd effect (eg. in Kitty app, line height produces unintended spacing at the top and bottom of the terminal) or modifying line height properly isn't possible (eg. Emacs). It'd be great if Fontfreeze lets you bake that in as well.

glyphs disabled for Fira Code v6.2

Hi,
I tried freezing with the following glyph settings, when downloaded the glyps for !=,==, =>, -> etc are all disabled,, or not working.

I'd like to know if I'm doing any mistake.

Thanks!

image

Exception while saving Source Code Pro font

I get the following exception when I try to freeze Source Code Pro.

An error occur: Traceback (most recent call last):
  File "<exec>", line 154, in processFont
  File "<exec>", line 157, in main
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 212, in save
    writer_reordersTables = self._save(tmp)
                            ^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 259, in _save
    self._writeTable(tag, writer, done, tableCache)
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 711, in _writeTable
    tabledata = self.getTableData(tag)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 733, in getTableData
    return self.tables[tag].compile(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 155, in compile
    self.table.compile(writer, font)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 1089, in compile
    conv.write(writer, font, table, value)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 754, in write
    value.compile(subWriter, font)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 1051, in compile
    conv.writeArray(writer, font, table, value)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 216, in writeArray
    self.write(writer, font, tableDict, value, i)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 634, in write
    value.compile(writer, font)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 1089, in compile
    conv.write(writer, font, table, value)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 754, in write
    value.compile(subWriter, font)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otBase.py", line 1089, in compile
    conv.write(writer, font, table, value)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otConverters.py", line 754, in write
    value.compile(subWriter, font)
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/otTables.py", line 517, in compile
    featureParamTypes.get(writer["FeatureTag"]) == self.__class__
AssertionError: ("Wrong FeatureParams type for feature 'calt': FeatureParamsStylisticSet", 'FeatureParamsStylisticSet', 'Feature', 237, 'FeatureRecord[]', 'FeatureList')

Steps to reproduce:

I tried this with Firefox, Chrome and Edge.

font subfamily support

Hello,

I used the tool to generate a full set of variations and it worked as expected, except for the subfamily and/or style setting.

For instance I'm unable to set the following subfamilies:

  • light
  • retina
  • medium

Exception while saving Maple Mono NF

Here is the github repo for the font

Here is the error message:

Error: Traceback (most recent call last):
  File "<exec>", line 156, in processFont
  File "<exec>", line 159, in main
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 212, in save
    writer_reordersTables = self._save(tmp)
                            ^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 259, in _save
    self._writeTable(tag, writer, done, tableCache)
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 711, in _writeTable
    tabledata = self.getTableData(tag)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 733, in getTableData
    return self.tables[tag].compile(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/_c_m_a_p.py", line 207, in compile
    chunk = table.compile(ttFont)
            ^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/_c_m_a_p.py", line 400, in compile
    gids = array.array("B", valueList)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: unsigned byte integer is greater than maximum

    at i.port1.onmessage (main.js:1:1432)

Procedure to reproduce the error (by edge or firefox):

  1. download the newest version of maple mono font and open it
  2. select any of cv01~cv04 feature
  3. generate the font with Apply substitution by single-glyph features. selected and get the error

Btw, the fontfreezer works well with the older version font.

Exception when freezing "cv" features on fonts missing "calt" table.

This is a great tool to "freeze" the open types features of a font, but I've encountered some errors in freezing "cv" features on some fonts, where the "calt" table is not present, similar to the issue that another user found with freezing "ss" features on such fonts which you have already fixed.

Steps to reproduce:

I would perhaps tentatively suggest the following fix to main.py.

  • In the code dealing with "no existing one", insert featureParamTypes[self.target] = FeatureParamsStylisticSet if featureRecord.FeatureTag.startswith("ss") else FeatureParamsCharacterVariants before featureRecord.FeatureTag = self.target.
  • Update the imports to include FeatureParamsCharacterVariants.
  • The line that previously set featureParamTypes['calt'] can be removed.

Does not work as expected

I tried freezing couple of features (use alternate variant of @ and &) of fira font, but in the generated ttf file both the glyps are still same as the default variant.

[Bug] got an error when generating font

the settings
2

and my font file:
MapleMonoSCNFNerdFont-Regular.ttf.zip

then I got an error:

An error occur: Traceback (most recent call last):
  File "<exec>", line 154, in processFont
  File "<exec>", line 157, in main
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 212, in save
    writer_reordersTables = self._save(tmp)
                            ^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 259, in _save
    self._writeTable(tag, writer, done, tableCache)
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 711, in _writeTable
    tabledata = self.getTableData(tag)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/ttFont.py", line 733, in getTableData
    return self.tables[tag].compile(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/ttLib/tables/O_S_2f_2.py", line 161, in compile
    self.panose = sstruct.pack(panoseFormat, self.panose)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.11/site-packages/fontTools/misc/sstruct.py", line 66, in pack
    obj = obj.__dict__
          ^^^^^^^^^^^^
AttributeError: 'str' object has no attribute '__dict__'

Error when trying to freeze JetBrains Mono

I get the following error when I try to freeze the current version (2.303) of JetBrains Mono:

An error occur: Traceback (most recent call last):
  File "<exec>", line 145, in processFont
  File "<exec>", line 149, in main
  File "/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 184, in save
    writer_reordersTables = self._save(tmp)
  File "/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 224, in _save
    self._writeTable(tag, writer, done, tableCache)
  File "/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 647, in _writeTable
    tabledata = self.getTableData(tag)
  File "/lib/python3.10/site-packages/fontTools/ttLib/ttFont.py", line 669, in getTableData
    return self.tables[tag].compile(self)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otBase.py", line 103, in compile
    self.table.compile(writer, font)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otBase.py", line 940, in compile
    conv.write(writer, font, table, value)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otConverters.py", line 631, in write
    value.compile(subWriter, font)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otBase.py", line 904, in compile
    conv.writeArray(writer, font, table, value)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otConverters.py", line 197, in writeArray
    self.write(writer, font, tableDict, value, i)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otConverters.py", line 510, in write
    value.compile(writer, font)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otBase.py", line 940, in compile
    conv.write(writer, font, table, value)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otConverters.py", line 631, in write
    value.compile(subWriter, font)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otBase.py", line 940, in compile
    conv.write(writer, font, table, value)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otConverters.py", line 631, in write
    value.compile(subWriter, font)
  File "/lib/python3.10/site-packages/fontTools/ttLib/tables/otTables.py", line 498, in compile
    assert featureParamTypes.get(writer['FeatureTag']) == self.__class__, "Wrong FeatureParams type for feature '%s': %s" % (writer['FeatureTag'], self.__class__.__name__)
AssertionError: ("Wrong FeatureParams type for feature 'DELT': FeatureParamsStylisticSet", 'FeatureParamsStylisticSet', 'Feature', 38, 'FeatureRecord[]', 'FeatureList')

I used JetBrainsMono-Regular.ttf and checked ss19 and zero. I kept everything else as default.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.