https://github.com/adobe-type-tools/afdko/ Adobe Font Development Kit for OpenType
https://github.com/mpcabd/python-arabic-reshaper/ Reconstruct Arabic sentences to be used in applications that don't support Arabic
https://github.com/adobe-type-tools/afdko/ Adobe Font Development Kit for OpenType
https://github.com/mpcabd/python-arabic-reshaper/ Reconstruct Arabic sentences to be used in applications that don't support Arabic
#!/usr/bin/env python3 | |
import shlex | |
import subprocess | |
import uharfbuzz as hb | |
font_dir = 'fonts/g/mac/10.15.7/' | |
font_path = f'{font_dir}Hiragino Kaku Gothic W4.ttc' | |
font_path = f'{font_dir}Hiragino MaruGothic ProN W4.ttc' | |
font_path = f'{font_dir}Hiragino Mincho ProN.ttc' |
# First of all you need install *libraqm* on your machin. | |
# The Raqm library encapsulates the logic for complex text layouts and provides a convenient API. | |
# libraqm relies on the following libraries: FreeType, HarfBuzz, FriBiDi, | |
# make sure that you install them before installing libraqm if not available as package in your system. | |
# if you using macos you can install libraqm with homebrew | |
# $> brew install libraqm | |
# Pillow wheels since version 8.2.0 include a modified version of libraqm |
from PIL import Image, ImageDraw, ImageFont | |
import PIL.features | |
# ! brew install libraqm | |
print('libraqm:', PIL.features.check('raqm')) | |
size = (320, 16) | |
""" | |
FORMAT = "RGB" |
from PIL import Image, ImageDraw, ImageFont, ImageFilter | |
im = Image.open("./blue30.png") | |
POS = (1, 4) | |
X = POS[0] * 80 | |
Y = POS[1] * 80 | |
im1 = im.crop((X, Y, X + 30, Y + 30)) |
#!/usr/bin/python3 | |
# -*- coding:utf-8 -*- | |
r"""テキストファイルを画像に変換 | |
このファイル自体はサブコマンンド向けに作られた内部のクラスを実行する | |
ためのダミー | |
使い方 | |
# 縦長(720x1280) 20桁 白色文字 黒色背景 ./font.ttf png形式 |
!wget https://github.com/Phonbopit/sarabun-webfont/raw/master/fonts/thsarabunnew-webfont.ttf | |
# !pip install -U --pre matplotlib | |
import matplotlib as mpl | |
mpl.font_manager.fontManager.addfont('thsarabunnew-webfont.ttf') # 3.2+ | |
mpl.rc('font', family='TH Sarabun New') |
import icu | |
thkey = icu.Collator.createInstance(icu.Locale('th_TH')).getSortKey | |
words = 'ไก่ ไข่ ก ฮา'.split() | |
print(sorted(words, key=thkey)) # ['ก', 'ไก่', 'ไข่', 'ฮา'] |
// INPUT: ၁၁.၁၂.၂၀၁၇ | |
// OUTPUT: 11.12.2017 | |
function mm2en(num) { | |
var nums = { '၀': '0', '၁': 1, '၂': 2, '၃': 3, '၄': 4 , '၅': 5, '၆': 6, '၇':7, '၈':8, '၉':9 }; | |
return num.replace(/([၀-၉])/g, function(s, key) { | |
return nums[key] || s; | |
}); | |
} |
#!/usr/bin/env PYTHONIOENCODING=utf-8 python | |
# encoding: utf-8 | |
from __future__ import absolute_import, print_function, unicode_literals | |
import os | |
import re | |
import requests |