«Khotot/Quick start»: الفرق بين المراجعتين

من ويكي عربآيز
اذهب إلى: تصفح، ابحث
ط (استبدال النص - 'http://cvs.arabeyes.org/viewcvs/art/khotot ' ب'https://git.arabeyes.org/arabeyes-art/khotot ')
ط (Get font files)
سطر 5: سطر 5:
   
 
==Get font files==
 
==Get font files==
Instead of editing a TTF file directly, we are going to work on SFD files (the internal database format that FF <ref>FontForge.</ref> uses). Those files are available at Arabeyes CVS. You can access the files using the web interface; https://git.arabeyes.org/arabeyes-art/khotot , or get your local cvs copy:
+
Instead of editing a TTF file directly, we are going to work on SFD files (the internal database format that FF <ref>FontForge.</ref> uses). Those files are available at Arabeyes CVS. You can access the files using the web interface; https://git.arabeyes.org/arabeyes-art/khotot , or get your local git clone:
   
cvs -d:pserver:anoncvs@cvs.arabeyes.org:/home/arabeyes/cvs login
+
git clone http://git.arabeyes.org/arabeyes-art/khotot
 
The password is 'anoncvs' (just like the login name).
 
 
cvs -z3 -d:pserver:anoncvs@cvs.arabeyes.org:/home/arabeyes/cvs co art/khotot
 
   
 
''NOTE'': This is about a 30MB download.
 
''NOTE'': This is about a 30MB download.

نسخة 04:23، 10 فبراير 2017

Requirements

  • FontForge: FontForge is our main font editing and development software, it is a free software. You will need version 20070723 at least. [1] Earlier versions lack some essential features.
  • ...

Get font files

Instead of editing a TTF file directly, we are going to work on SFD files (the internal database format that FF [2] uses). Those files are available at Arabeyes CVS. You can access the files using the web interface; https://git.arabeyes.org/arabeyes-art/khotot , or get your local git clone:

git clone http://git.arabeyes.org/arabeyes-art/khotot

NOTE: This is about a 30MB download.

Editing the font

We are going to fix the anchor points, anchor points are helper points over the glyphs that tell the font renderer where to position the glyphs relatively to each others. In our case, we have two types of glyphs; base glyphs like Alef (أ), Beh (ب) ..., and diacritic marks (Harakat[3]) like Fathah (َ ) and Dammah (ُ ).

Each base glyph has two anchor points, one above it called ArabicAbove, and one below it called Arabic below. Ligatures[4] has anchor points for each component, the most common example is Lam Alef which has anchor points for Lam part and Alef part.

Each diacritic mark has four anchor points, one for normal glyphs and one for ligatures, both should have the same position. There are two other anchor points used for relations between diacritic marks and each others, called ArabicMark2MarkAbove and ArabicMark2MarkBelow.

Edit Harakat

First select Encoding -> Compact, this will get rid of empty code points and will make navigating through the font easier.

Editing Fathatan glyph.

At first we will edit anchor points in diacritic (Harakat) glyphs, in "View -> Go To" type uni064b, this will take you to Fathatan glyph, click on it then move the anchor points (the blue star) just below it, see the screen shot.

Repeat this with other marks, but remember in case of Kasrah and Kasratan to put the anchor points just above the marks.

Shaddah is a special case, its ArabicMark2MarkAbove point should be above it as this point will used to place marks like Fathah and Dammah above Shaddah, other points should be bellow it.

Tips:

  • Use "Ctrl ]" and "Ctrl [" to move to previous and next glyphs.
  • To move all anchor points in a glyph at once, double click on them until the star takes a light color, provided that those anchor points lay over each other.

Editing base glyphs

Instead of editing each glyph separately, we will use a nice FF dialog called Anchor Control dialog. This dialog allow editing anchor points and viewing its effect on the fly, which allows tuning the position of each point.

Go to Element -> Font Info -> Lookups -> GPOS , choose one of the three lookup tables:

  • "'mark' Mark to base in Arabic lookup 0" : for marks above ordinary base glyphs.
  • "'mark' Mark to ligature in Arabic lookup 1" : or marks above ligatures.
  • "'mkmk' Mark to Mark in Arabic lookup 2" : for the relation between marks and each others.
Anchor control dialog

click on the [+] to open its subtables, select a subtable then click on the "Edit Data" button from the side panel. From the dialog select an anchor point then click on the Anchor control button.

From the anchor control dialog you can adjust anchor points as appropriate and see its effect, use Page Up and Page Down to navigate through the glyphs.

When marking anchors to ligatures, the Anchor Control dialog will include many occurences of a certain ligature in the drop down menu, depending on the number of letters composing the ligature (Twice for Lamalef). Therefore, pay attention to place the anchors on the different letters respectively as in the drop down menu.

Stacked Diacritics

When there are two diacritics over a glyph (For example: بَّ), one should be above the other. To avoid the overlap that would happen, we use a ligature substitution mechanism.

Glyphs to add

Code Point Components Glyph
U+FC5E Shadda dammatan FC5E.png
U+FC5F Shadda kasratan FC5F.png
U+FC60 Shadda fatha FC60.png
U+FC61 Shadda damma FC61.png
U+FC62 Shadda kasra FC62.png

The above tables lists each glyph and its component. To access the code points in Fontforge, be sure "Compact" is unchecked in the "Encoding" menu. Then go to "View -> Goto" to type the unicode value of the glyph. Edit the glyph as appropriate.

Add lookup tables

From "File -> Execute Script", check the FF box, and type:

AddLookup("'rlig' Required Ligature in Arabic lookup 6", "gsub_ligature", 1, [["rlig",[["arab",["dflt"]]]]])
AddLookupSubtable("'rlig' Required Ligature in Arabic lookup 6", "'rlig' Required Ligature in Arabic lookup 6-1")

Go back the the glyphs. In the entry "Element -> Glyph Info -> Ligatures", click on "New Ligature", choose "'rlig' Required Ligature in Arabic lookup 6-1" from the menu. In the next text box, enter the components name of the ligature, (shadda dammatan) for example. Repeat this with the other glyphs and save your font.

As a lst step, remove "'mkmk' Mark to Mark in Arabic lookup 2" lookup table, from Element -> Font Info -> Lookups -> GPOS , this to insure mark2mark anchors won't be used insted of the ligatures.

Test the font

Generate it

After playing with the font, you will need to build a TTF[5] file to test it.

We have a tool for this; tools/generate.pe, copy this files to your home directory, then:

./generate.pe font.sfd font.ttf

Where font.sfd is the original file and font.ttf is the name of the file that will be generated.

Install it

cp font.ttf ~/.fonts
fc-cache -v -f ~/.fonts

Then open any text editor like Gedit or Kedit and test your font, avoid testing it in OpenOffice as it might give you wrong behaviour.



  1. FontForge can be found in its web page, fontforge.sourceforge.net.
  2. FontForge.
  3. Harakat are the small vowel marks that lay above the characters to indicate its pronunciation.
  4. A ligature is a combination of two characters or more into one glyph, the only mandatory ligature in Arabic is Lam Alef.
  5. TrueType Font.