«Developing Arabic fonts»: الفرق بين المراجعتين

من ويكي عربآيز
اذهب إلى: تصفح، ابحث
(more rewrite)
(Font building)
سطر 19: سطر 19:
 
Unicode defines two types of Arabic code points. Arabic block, U+0600 - U+06FF, which contain almost all Arabic code points, and Arabic supplement, U+0750 - U+077F, which contains some extra characters. There also Arabic presentation forms A and B, U+FB50 - U+FDFF and U+FE70 - U+FEFF, Arabic presentation forms code different forms of Arabic letters and some ligatures, however, they are included for compatibility with legacy encodings and should never be used to directly encode the text. Presentation forms can be used when defining substitution tables, but that is not mandatory as you can added the contextual forms as unencoded glyphs to your font, and tell OpenType engine which glyph to use through the lookup tables. Note that, including the presentation forms in your font doesn't mean that they will be used, you must add lookup tables.
 
Unicode defines two types of Arabic code points. Arabic block, U+0600 - U+06FF, which contain almost all Arabic code points, and Arabic supplement, U+0750 - U+077F, which contains some extra characters. There also Arabic presentation forms A and B, U+FB50 - U+FDFF and U+FE70 - U+FEFF, Arabic presentation forms code different forms of Arabic letters and some ligatures, however, they are included for compatibility with legacy encodings and should never be used to directly encode the text. Presentation forms can be used when defining substitution tables, but that is not mandatory as you can added the contextual forms as unencoded glyphs to your font, and tell OpenType engine which glyph to use through the lookup tables. Note that, including the presentation forms in your font doesn't mean that they will be used, you must add lookup tables.
   
= Font building =
+
= Tools =
   
  +
Through out this tutorial we will use mainly [http://fontforge.sourceforge.net FontForge] as a font editor. FontForge is capable for both editing glyph outlines, and OpenType table, and scriptable (using either python or its legacy scripting language).
== Tools ==
 
   
  +
= First start =
Through out this tutorial we will use mainly fontforge as a font development tool.
 
Fontforge is a free software application, runs on GNU/Linux and other similar Unix
 
like systems (including Mac OS X), also runs on MS Windows systems under Cygwin.
 
One of its the very handy features is its scripting interface, which allows
 
writing small scripts (either in python or in fontforge's legacy scripting
 
language) that automate tedious repeated tasks which helps greatly in minimizing
 
the effort of font development.
 
   
  +
Start fontforge with no arguments, it'll ask you for a font to open, just choose new, or pass <code>-new</code> option to it in the command line. FontForge doesn't encode the new font as Unicode by default, go to Encoding -> Reencode and choose "ISO 10646-1 (Unicode, full)", this way Arabic Unicode points will be available for us to edit.
== Building new font ==
 
   
 
Basically, for a font to support Arabic language, we should cover U+0621 - U+0652 (Arabic letters) and U+0660 - U+0669 (Arabic digits; what Unicode calls "Arabic-Indic digits). Refer to [http://unicode.org/charts/ Unicode charts] for the details of each glyph.
Start fontforge with no arguments, it'll ask you for a font to open, just
 
choose new, or pass <code>-new</code> option to it in the command line. Fontforge
 
doesn't encode the new font as Unicode by default, go to Encoding -> Reencode and
 
choose "ISO 10646-1 (Unicode, full)", this way Arabic Unicode points will be
 
available for us to edit.
 
   
 
= Initial, medial and final forms =
Basically, for a font to support Arabic language, we should cover FIXME code points. Refer to Unicode charts for the details of each glyph.
 
   
=== Initial, medial and final forms ===
 
 
FE70-FEFF (and part of FB50-FDFF) points cover initial, medial, final and isolated forms of The above Arabic code points, refer to FIXME for description of each glyph. FEF5-FEFC are the various forms of lam-alef ligature, though the simplest way to support lam-alef is by using those ligatures, it isn't the only way and not necessarily the best way, we will discuss this in details later.
 
FE70-FEFF (and part of FB50-FDFF) points cover initial, medial, final and isolated forms of The above Arabic code points, refer to FIXME for description of each glyph. FEF5-FEFC are the various forms of lam-alef ligature, though the simplest way to support lam-alef is by using those ligatures, it isn't the only way and not necessarily the best way, we will discuss this in details later.
   
 
After creation of the above glyphs, we will need to to add OpenType lookup tables that define substitution rules for those glyphs, what we'll use here is single substitution tables of the type 'init', 'med' and 'fina'.
 
After creation of the above glyphs, we will need to to add OpenType lookup tables that define substitution rules for those glyphs, what we'll use here is single substitution tables of the type 'init', 'med' and 'fina'.
   
=== Lam-Alef ===
+
= Lam-Alef =
  +
 
In modern Arabic typography, lam-alef is considered the only mandatory ligature.
 
In modern Arabic typography, lam-alef is considered the only mandatory ligature.
 
There is basically to ways to support lam-alef in your font; ligature substitution
 
There is basically to ways to support lam-alef in your font; ligature substitution
 
and contextual substitution.
 
and contextual substitution.
   
==== Ligature substitution ====
+
= Ligature substitution =
  +
 
Almost all font designers use ligature substitution because its simplicity, however it isn't always the best way. Many OpenType implementations doesn't support ligature caret table, giving us no control on where to insert the cursor between ligature components, which makes the experience of editing text with many ligatures not so pleasant. Here we will need simple ligature substitution table, 'liga', FIXME
 
Almost all font designers use ligature substitution because its simplicity, however it isn't always the best way. Many OpenType implementations doesn't support ligature caret table, giving us no control on where to insert the cursor between ligature components, which makes the experience of editing text with many ligatures not so pleasant. Here we will need simple ligature substitution table, 'liga', FIXME
   
==== Contextual substitution ====
+
= Contextual substitution =
  +
 
In my opinion, contextual substitution is superior to ligature substitution, it
 
In my opinion, contextual substitution is superior to ligature substitution, it
 
decreases the number of unnecessary glyphs in your font, avoid all problems that
 
decreases the number of unnecessary glyphs in your font, avoid all problems that

نسخة 17:24، 12 ديسمبر 2007

Inprogress.svg <translate>

In progress</translate>

<translate>

This page is a work in progress. Feel free to contribute. More info may be added by others.</translate>

<translate></translate>

Arabic is said to be complex script, compared to simple scripts like Latin and Cyrillic. To render Arabic text correctly we need more sophisticated font technologies, what is so called `smart fonts', like OpenType, AAT from Apple and SIL's graphite.

Features of Arabic script

Arabic is a cursive script, written from right to left. Each letter has, at least, 4 basic forms (with few exceptions); initial, middle, final and isolated forms, each of which might take different shapes according to the context and calligraphic style.

In OpenType fonts, there are lookup tables that define the various forms of each character, basically initial, medial and final forms simple substiution tables.

Another feature is ligatures (though the name ligature is misleading, as those ligatures are mandatory in Arabic, unlike Latin ligatures). Basically, the ligature is a special glyph that is composed of two or more glyphs. Take lam-alef as an example, it is a glyph that is composed of lam (initial or medial form) with alef (final form). However, if we looked carefully, we will see that lam-alef is no exception, just a special form of lam that it only takes when followed by alef, the same for the alef. In OpenType, lam-alef and like can be addressed either by using ligatures, or more complex contextual substitution.

Another feature of the Arabic script is the extensive use of diacritic marks known as Harakat or Tashkil, those small vocalization marks lay above or bellow base glyphs, a well designed font must provide attachment points to define the spatial relation between diacritic mark and base glyph. As Arabic diacritics may be stacked above each other in relation to one base glyph, it is important to address mark to mark relations.

Arabic in Unicode

Unicode defines two types of Arabic code points. Arabic block, U+0600 - U+06FF, which contain almost all Arabic code points, and Arabic supplement, U+0750 - U+077F, which contains some extra characters. There also Arabic presentation forms A and B, U+FB50 - U+FDFF and U+FE70 - U+FEFF, Arabic presentation forms code different forms of Arabic letters and some ligatures, however, they are included for compatibility with legacy encodings and should never be used to directly encode the text. Presentation forms can be used when defining substitution tables, but that is not mandatory as you can added the contextual forms as unencoded glyphs to your font, and tell OpenType engine which glyph to use through the lookup tables. Note that, including the presentation forms in your font doesn't mean that they will be used, you must add lookup tables.

Tools

Through out this tutorial we will use mainly FontForge as a font editor. FontForge is capable for both editing glyph outlines, and OpenType table, and scriptable (using either python or its legacy scripting language).

First start

Start fontforge with no arguments, it'll ask you for a font to open, just choose new, or pass -new option to it in the command line. FontForge doesn't encode the new font as Unicode by default, go to Encoding -> Reencode and choose "ISO 10646-1 (Unicode, full)", this way Arabic Unicode points will be available for us to edit.

Basically, for a font to support Arabic language, we should cover U+0621 - U+0652 (Arabic letters) and U+0660 - U+0669 (Arabic digits; what Unicode calls "Arabic-Indic digits). Refer to Unicode charts for the details of each glyph.

Initial, medial and final forms

FE70-FEFF (and part of FB50-FDFF) points cover initial, medial, final and isolated forms of The above Arabic code points, refer to FIXME for description of each glyph. FEF5-FEFC are the various forms of lam-alef ligature, though the simplest way to support lam-alef is by using those ligatures, it isn't the only way and not necessarily the best way, we will discuss this in details later.

After creation of the above glyphs, we will need to to add OpenType lookup tables that define substitution rules for those glyphs, what we'll use here is single substitution tables of the type 'init', 'med' and 'fina'.

Lam-Alef

In modern Arabic typography, lam-alef is considered the only mandatory ligature. There is basically to ways to support lam-alef in your font; ligature substitution and contextual substitution.

Ligature substitution

Almost all font designers use ligature substitution because its simplicity, however it isn't always the best way. Many OpenType implementations doesn't support ligature caret table, giving us no control on where to insert the cursor between ligature components, which makes the experience of editing text with many ligatures not so pleasant. Here we will need simple ligature substitution table, 'liga', FIXME

Contextual substitution

In my opinion, contextual substitution is superior to ligature substitution, it decreases the number of unnecessary glyphs in your font, avoid all problems that arise from using ligatures and make your font more close to the soul of Arabic calligraphy. But it needs careful analysis of Arabic calligraphy to define

properly the start and end of each glyph.