OpenPecha / create-font-from-glyph

MIT License
0 stars 1 forks source link

OCR0017: Creating Font by taking 10 glyphs of each Tibetan characters and ligatures. (4) #17

Open 10kalden opened 6 months ago

10kalden commented 6 months ago

Description: The objective of the task is to create a digital font from the print font of the major publishers such as Derge, Pecing and Shul by taking 10 glyphs of each Tibetan character. The font creation process is previously implemented by taking one random glyph for each Tibetan character.

Since The Derge Pechas are printed on wooden blocks, there are many variations for the same Tibetan characters and ligature. To include all the variations of the characters and ligatures in the font, 10 glyphs from each character are taken in the font creation process.

Completion Criteria: Fully completed font in TTF format with most of the variation of the character included.

Font files: https://drive.google.com/drive/folders/1vqTJJ4ThcGckN1OtfUyheJZkYq2ggIOY?usp=drive_link

Implementation Plan:

Image

Sub-task:

Image

Sub-task:

10kalden commented 6 months ago

https://www.calligraphr.com/en/webapp/app_home/?/

Image

10kalden commented 6 months ago

According to my research, I found two ways to include the variant glyph in the font.

  1. Stylistic Set using the OTF feature Stylistic set, we can create stylistic sets for different print styles. it will group the alternate glyphs. but using this requires manually changing the stylistic set according to need when using a word processor like MS Word. Randomization could be possible through the scripting method. https://typedrawers.com/discussion/1357/how-can-i-randomize-letters-in-a-typeface https://graphicdesign.stackexchange.com/questions/11342/how-does-random-choice-of-alternate-characters-work-in-opentype-fonts

  2. Contextual Alternate currently modifying the pipeline to add glyphs as contextual alternates using the OTF feature, I will test with this method to randomize the glyphs. https://forum.glyphsapp.com/t/stylistic-alternates-vs-contextual-alternatives/13478

Image

10kalden commented 6 months ago

Image

the Calt feature rules are defined like this



``` feature calt {
    # Substitute 'a.alt1' for 'a' when 'a' is followed by 'b'
    sub a' b by a.alt1;
    # Substitute 'a.alt2' for 'a' when 'a' is followed by 'c'
    sub a' c by a.alt2;
    # Add more rules as needed...
} calt;
10kalden commented 6 months ago
10kalden commented 6 months ago

issue#01: added a rule for simulating randomness, but it replaced the already present rule in the existing font for ligature replacement. sol#01:

  1. I tried extracting the feature file from the existing font and appending the Calt feature file to it, but it didn't work.
  2. currently, tried this method: did some research for ligature replacement rule and wrote a new feature file for ligature replacement. so instead of having one feature file with both Liga and Calt features, wrote a separate feature file. currently fixing some bugs and require testing

rules for ligature replacement Image

10kalden commented 6 months ago
10kalden commented 6 months ago

Image

10kalden commented 6 months ago

font link to single gylph and variation glyph: https://drive.google.com/drive/u/0/folders/1vqTJJ4ThcGckN1OtfUyheJZkYq2ggIOY

ngawangtrinley commented 6 months ago

@10kalden What is the reason you are not creating a font from scratch?

10kalden commented 6 months ago
ngawangtrinley commented 6 months ago

It looks like you are running into limitations with existing fonts though, you don't have enough codepoints and it seems like you also have issues with ligatures. Can you give it a try? Now you are quite familiar with font building and you can get help from ChatGPT or Gemini. If you ask AI to give you code one step at a time you'll get good results.

You can try to use the command line of fontforge from python scripts if you don't get much luck with fonttools (by asking AI to write the code to start of course).

A few months ago I did some tests with the help of perplexity.ai and got very good results. We shouldn't be limited by the number of codepoints of old fonts.

Here's a sample chat with Gemini to give your an idea of what I mean: https://gemini.google.com/share/6e511e00b17e.

You can also ask for alternative approaches like https://gemini.google.com/share/9403ff9c1343.

10kalden commented 6 months ago

@ngawangtrinley Yes, I was running into issues with the variants due to the limitations of the lookup table of the existing font.

I will make the font without using an existing font. I have already started with the script. I get help from AI also.

10kalden commented 6 months ago

Image

to solve the spacing issue, we need to adjust the advance width advance width = glyph width + lsb + rsb

10kalden commented 6 months ago

@ngawangtrinley hello, I set up a font file using python, but i am running into various issues when setting up some tables by using fonttools. I found an empty font file its called AdobeBlank.ttf(kind of like a templete). I was thinking if we can add all the glyph to this font, set our own metrics. what do you think of this approach. it'll solve the limitation issue. If not, I will try using the Fontforge CLI.

UPDATE: found a way to make font from scratch without using a blank font

10kalden commented 6 months ago

update: got suggestion on font forum to use the method of blank font files, used adobeblank.ttf and created font form scratch.

Image

10kalden commented 6 months ago

got more information about creating a font without using Adobe Blank, using fontbuilder class, tried it this morning and created a font from scratch without taking any blank font. need to test which is better and will take suggestions.

@kaldan007 font for testing https://github.com/OpenPecha/create-font-from-glyph/tree/feature/font-from-scratch/fonts/derge_font

Blocker: