Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

made leo

  • Loading branch information...
commit ed4e910ea86d8db518c29b42601b3705cb09602c 1 parent c0ca4fd
@natsag2000 authored
Showing with 74 additions and 14 deletions.
  1. +41 −12 fontcreator/crazyfonter.py
  2. +33 −2 fontcreator/mongoluseg.py
View
53 fontcreator/crazyfonter.py
@@ -1,19 +1,35 @@
#!/usr/bin/env python
+# -- coding: utf-8 --
+#@+leo-ver=5-thin
+#@+node:nagi.20101207083602.1317: * @file /home/nagi/nagi-gits/mongolbichig/fontcreator/crazyfonter.py
+#@@first
+#@@first
+#@@language python
+#@@tabwidth -4
+#@+others
+#@+node:nagi.20101207083602.1328: ** толгой хэсэг
+# ----------------------------------------------------------------
# __ __ ___ _ _ ____ ___ _ _ _ ____ _____ ____
# | \/ |/ _ \| \ | |/ ___|/ _ \| | | | | / ___|| ____/ ___|
# | |\/| | | | | \| | | _| | | | | | | | \___ \| _|| | _
# | | | | |_| | |\ | |_| | |_| | |___ | |_| |___) | |__| |_| |
# |_| |_|\___/|_| \_|\____|\___/|_____| \___/|____/|_____\____|
#
-# crazy font creator
-# Author: nagi (natsag2000@googlemail.com)
+# mongol otf font creator
+# отф тиг үүсгэгч
#
+# Author: nagi (natsag2000@googlemail.com)
+# ----------------------------------------------------------------
+#@+node:nagi.20101207083602.1318: ** imports and globals
+#@+<<imports>>
+#@+node:nagi.20101207083602.1329: *3* <<imports>>
import fontforge
import ConfigParser
import os
import psMat
from math import pi
+#@-<<imports>>
# GLOBALS
MONGOL_USEG = ''
@@ -33,6 +49,7 @@
# private usage zone
PRIVATE_ZONE =hex(0xf300)
+#@+node:nagi.20101207083602.1319: ** main үндсэн гол дуудагдах функц
def main():
global MONGOL_USEG
global MONGOL_USEG_EXT
@@ -45,16 +62,7 @@ def main():
replace_feature()
generate_font("crazyfont.ttf")
-def prepare_font():
- global BASE_FONT
- global TMP_FONT
- global FONT
- fontbase = fontforge.open(BASE_FONT)
- # Delta char has conflict by otf generation, so delete it
- fontbase["Delta"].clear()
- fontbase.generate(TMP_FONT)
- FONT = fontforge.open(TMP_FONT)
-
+#@+node:nagi.20101207083602.1321: ** read_config
def read_config():
global MONGOL_USEG
global MONGOL_USEG_EXT
@@ -82,14 +90,29 @@ def read_config():
VERSION = config.get('General', 'VERSION')
+#@+node:nagi.20101207083602.1320: ** prepare_font
+def prepare_font():
+ global BASE_FONT
+ global TMP_FONT
+ global FONT
+ fontbase = fontforge.open(BASE_FONT)
+ # Delta char has conflict by otf generation, so delete it
+ fontbase["Delta"].clear()
+ fontbase.generate(TMP_FONT)
+ FONT = fontforge.open(TMP_FONT)
+
+#@+node:nagi.20101207083602.1322: ** read_lines
def read_lines(FileName):
f = file(FileName, 'r')
lines = f.readlines()
f.close()
return lines
+#@+node:nagi.20101207083602.1323: ** create_standart_zone
+#@+at
# first unicode standart zone
# TODO check special cases: maaglha, dottedcircle etc!!
+#@@c
def create_standart_zone(Usegs):
global GLYPHS_DIR
global FONT
@@ -109,6 +132,7 @@ def create_standart_zone(Usegs):
FONT[letter].left_side_bearing = 15
FONT[letter].right_side_bearing = 15
+#@+node:nagi.20101207083602.1324: ** create_private_zone
def create_private_zone(Usegs):
global PRIVATE_ZONE
global GLYPHS_DIR
@@ -128,6 +152,7 @@ def create_private_zone(Usegs):
FONT[letter].right_side_bearing = -15
deccounter = deccounter + 1
+#@+node:nagi.20101207083602.1325: ** replace_feature
# replace feature
def replace_feature(Fea = None):
global FONT
@@ -144,6 +169,7 @@ def replace_feature(Fea = None):
else:
FONT.mergeFeature(Feature)
+#@+node:nagi.20101207083602.1326: ** generate_font
def generate_font(FontFileName):
global FONTNAME
global FAMILYNAME
@@ -156,9 +182,12 @@ def generate_font(FontFileName):
FONT.fontname = FONTNAME
FONT.generate(FontFileName)
+#@+node:nagi.20101207083602.1327: ** rotate_glyph
def rotate_glyph(Glyph):
matrix = psMat.rotate(pi/2)
Glyph.transform(matrix)
+#@-others
if __name__ == '__main__':
main()
+#@-leo
View
35 fontcreator/mongoluseg.py
@@ -1,4 +1,14 @@
#!/usr/bin/env python
+# -- coding: utf-8 --
+#@+leo-ver=5-thin
+#@+node:nagi.20101207083602.1297: * @file /home/nagi/nagi-gits/mongolbichig/fontcreator/mongoluseg.py
+#@@first
+#@@first
+#@@language python
+#@@tabwidth -4
+#@+others
+#@+node:nagi.20101207083602.1309: ** толгой хэсэг
+# ----------------------------------------------------------------
# __ __ ___ _ _ ____ ___ _ _ _ ____ _____ ____
# | \/ |/ _ \| \ | |/ ___|/ _ \| | | | | / ___|| ____/ ___|
# | |\/| | | | | \| | | _| | | | | | | | \___ \| _|| | _
@@ -6,18 +16,25 @@
# |_| |_|\___/|_| \_|\____|\___/|_____| \___/|____/|_____\____|
#
# crazy useg creator
-# Author: nagi (natsag2000@googlemail.com)
+# үсэг үүсгэгч
#
+# Author: nagi (natsag2000@googlemail.com)
+# ----------------------------------------------------------------
+#@+node:nagi.20101207083602.1298: ** import хэсэг
import ConfigParser
import subprocess
import re
import os
+#@+node:nagi.20101207083602.1299: ** main гол дуудагдах функц
def main():
# read config file
config = ConfigParser.RawConfigParser()
config.read("config.cfg")
- # TODO: check if they exist!
+ #@+<<TODO тохиргооны оруулгууд зөв эсэхийг шалгах>>
+ #@+node:nagi.20101207083602.1313: *3* <<TODO тохиргооны оруулгууд зөв эсэхийг шалгах>>
+ # TODO: Тохиргооны оруулгууд зөв үү гэдгийг шалга!
+ #@-<<TODO тохиргооны оруулгууд зөв эсэхийг шалгах>>
USEG_ATOM = config.get('Mongol useg', 'USEG_ATOM')
USEG_DESC = config.get('Mongol useg', 'USEG_DESC')
ATOM_FOLDER=config.get('Mongol useg', 'ATOM_FOLDER')
@@ -31,6 +48,7 @@ def main():
descs = read_desc(usegdesc)
useg_uusge(atoms, descs, ATOM_FOLDER, GLYPH_OUT)
+#@+node:nagi.20101207083602.1300: ** useg_uusge
def useg_uusge(Atoms, Desc, AFolder, OFolder):
atomkeys = Atoms.keys()
Missed = {}
@@ -75,11 +93,16 @@ def useg_uusge(Atoms, Desc, AFolder, OFolder):
for Key in Missed.keys():
print Key, ' : ', Missed[Key]
+#@+node:nagi.20101207083602.1301: ** createByCopy
+#@+at
+# зөвхөн сангаас сангийн хооронд хуулна
+#@@c
def createByCopy(AFolder, OFolder, NameA, NameB):
AFile = AFolder + '/' + NameA
BFile = OFolder + '/' + NameB
copyGlyph(AFile, BFile)
+#@+node:nagi.20101207083602.1302: ** copyGlyph
def copyGlyph(A, B):
Cmd = 'cp ' + A + ' ' + B
if not subprocess.call(Cmd, shell=True) == 0:
@@ -87,11 +110,13 @@ def copyGlyph(A, B):
else:
print B, " is copied succesfully!"
+#@+node:nagi.20101207083602.1303: ** isNumber
def isNumber(Str):
if Str.startswith("-") or Str.startswith("+"):
return Str[1:].isdigit()
return Str.isdigit()
+#@+node:nagi.20101207083602.1304: ** read_atoms
def read_atoms(List):
dic = dict()
for L in List:
@@ -108,6 +133,7 @@ def read_atoms(List):
dic[L1] = L1
return dic
+#@+node:nagi.20101207083602.1305: ** read_desc
def read_desc(List):
dic = dict()
for L in List:
@@ -122,18 +148,23 @@ def read_desc(List):
dic[L2[0]] = L2[1]
return dic
+#@+node:nagi.20101207083602.1306: ** splitAndStrip
def splitAndStrip(Line, Pattern):
return [ X.strip() for X in Line.split(Pattern) if X != '']
+#@+node:nagi.20101207083602.1307: ** isEmptyOrComment
def isEmptyOrComment(Line):
if Line.startswith('#') or len(Line) == 0:
return True
+#@+node:nagi.20101207083602.1308: ** readlines
def readlines(FileName):
f = file(FileName, 'r')
lines = f.readlines()
f.close()
return lines
+#@-others
if __name__=='__main__':
main()
+#@-leo
Please sign in to comment.
Something went wrong with that request. Please try again.