This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Knayi-myscript Detection and font tagging script | |
* | |
* Nov 10, 2014 | |
* greenlikeorange<beginofalove@hotmail.com> | |
* | |
* original: | |
* https://github.com/greenlikeorange/knayi-myscript | |
* | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var regexMM = new RegExp("[\u1000-\u109f\uaa60-\uaa7f]+"); | |
var text = "မြန်မာ"; | |
if (!regexMM.test(text)) { | |
console.log("not myanmar text"); | |
} | |
else { | |
console.log("myanmar text"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allow syntax extensions | |
XRegExp.install("extensibility"); | |
/* Adds Unicode code point syntax to XRegExp: \u{n..} | |
* `n..` is any 1-6 digit hexadecimal number from 0-10FFFF. Comes from ES6 proposals. Code points | |
* above U+FFFF are converted to surrogate pairs, so e.g. `\u{20B20}` is simply an alternate syntax | |
* for `\uD842\uDF20`. This can lead to broken behavior if you follow a `\u{n..}` token that | |
* references a code point above U+FFFF with a quantifier, or if you use the same in a character | |
* class. Using `\u{n..}` with code points above U+FFFF is therefore not recommended, unless you | |
* know exactly what you're doing. XRegExp's handling follows ES6 proposals for `\u{n..}`, since |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install libxext-dev libxt-dev | |
wget http://downloads.ghostscript.com/public/ghostpdl-9.05.tar.bz2 | |
tar xjf ./ghostpdl-9.05.tar.gz | |
cd ghostpdl-9.05/ | |
./configure | |
echo '#define HAVE_SYS_TIME_H' >> xps/obj/gconfig_.h | |
make xps | |
./xps/obj/gxps -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -r150 -o /tmp/a.pdf ~/POWERPOINT.xps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mmstrlen($str) { | |
$standalones = array("ဤ", "၍", "ဪ", "၏", "၊", "။", "၌"); | |
$consonants = array("က", "ခ", "ဂ", "ဃ", "င", "စ", "ဆ", "ဇ", "ဈ", "ည", "ဍ", "ဌ", "ဋ", "ဎ", "ဏ", "တ", "ထ", "ဒ", "ဓ", "န", "ပ", "ဖ", "ဗ", "ဘ", "မ", "ယ", "ရ", "လ", "ဝ", "သ", "ဟ", "ဠ", "အ"); | |
$numbers = array("၀", "၁", "၂", "၃", "၄", "၅", "၆", "၇", "၈", "၉"); | |
$len = mb_strlen($str, "UTF-8"); | |
$count = 0; | |
for($i = 0; $i < $len; $i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding:utf-8 -*- | |
r"""テキストファイルを画像に変換 | |
このファイル自体はサブコマンンド向けに作られた内部のクラスを実行する | |
ためのダミー | |
使い方 | |
# 縦長(720x1280) 20桁 白色文字 黒色背景 ./font.ttf png形式 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
OlderNewer