summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-03-19 22:10:06 +0100
committerPhilipp Gesang <pgesang@ix.urz.uni-heidelberg.de>2010-03-19 22:10:06 +0100
commite6e1e893c0bb13e4cdb9d2e58afc981257a73b81 (patch)
tree0cb913011d4e18f91becc1c8abeeba9d4012694b
parentde7913532bd56d8d7d88ac1ef522e18157eaac17 (diff)
downloadtransliterator-e6e1e893c0bb13e4cdb9d2e58afc981257a73b81.tar.gz
dirty hack to be used with limited fonts
-rw-r--r--tex/context/third/transliterator/t-transliterator.mkiv17
-rw-r--r--tex/context/third/transliterator/trans_tables_iso9.lua17
-rw-r--r--tex/context/third/transliterator/trans_tables_scntfc.lua8
3 files changed, 37 insertions, 5 deletions
diff --git a/tex/context/third/transliterator/t-transliterator.mkiv b/tex/context/third/transliterator/t-transliterator.mkiv
index 16c197b..ef8c15e 100644
--- a/tex/context/third/transliterator/t-transliterator.mkiv
+++ b/tex/context/third/transliterator/t-transliterator.mkiv
@@ -31,6 +31,13 @@
%D \type{ru}, \type{ru_transcript_de}, \type{ru_transcript_en}, \type{ru_old},
%D \type{all}, \type{iso9_ocs}, \type{ocs}, \type{ocs_gla}, \type{ru_cz},
%D \type{ocs_cz}, \type{gr} and \type{gr_n}.
+%D As not all fonts, even the expensive ones, support some of the most frequent
+%D unicode signs used in ISO~9 there are fallbacks for the transliterations of
+%D the weak and hard sign: \type{iso9_ocs_hack}, which is essentially
+%D \type{iso9_ocs}, and \type{ru_old_jer_hack}, which is essentially
+%D \type{ru_old}. These two transliterate {\em ь} and {\em ъ} (both upper and
+%D lower case) to the more common, but non-ISO characters {\em '} and {\em ''}
+%D respectively.
%D Possible values for \type{hyphenate} are all valid \CONTEXT\ language code, for an
%D overview see \type{http://wiki.contextgarden.net/Language_Codes}.
%D In praxi you may want to choose either Czech (the default) or Slovak
@@ -223,8 +230,9 @@ end
\startluacode
function translit.transliterate (method, text)
- if method == "ru" or
- method == "ru_old" or
+ if method == "ru" or
+ method == "ru_old" or
+ method == "ru_old_jer_hack" or
method == "all"
then
environment.loadluafile ("trans_tables_iso9")
@@ -238,8 +246,9 @@ function translit.transliterate (method, text)
then
environment.loadluafile ("trans_tables_trsc")
text = translit.transcript (method, text)
- elseif method == "iso9_ocs" or
- method == "ocs" or
+ elseif method == "iso9_ocs" or
+ method == "iso9_ocs_hack" or
+ method == "ocs" or
method == "ocs_gla"
then
environment.loadluafile ("trans_tables_scntfc")
diff --git a/tex/context/third/transliterator/trans_tables_iso9.lua b/tex/context/third/transliterator/trans_tables_iso9.lua
index f85ed35..4518466 100644
--- a/tex/context/third/transliterator/trans_tables_iso9.lua
+++ b/tex/context/third/transliterator/trans_tables_iso9.lua
@@ -107,6 +107,15 @@ translit.ru_old_upp = {
["Ѵ"] = "Ỳ", -- U+0474 -> U+1ef2 -- 3-byte
}
+translit.ru_jer_hack = {
+ ["ь"] = "'",
+ ["Ь"] = "'",
+ ["ъ"] = "''",
+ ["Ъ"] = "''",
+}
+
+translit.tables["russian magkij / tverdyj znak hack"] = translit.ru_jer_hack
+
translit.tables["russian pre-1918 uppercase ISO~9 2 byte"] = translit.ru_old_upp
---------------------------------------------------------
@@ -276,6 +285,14 @@ function translit.iso9 (mode, text)
end
end
+ if mode == "ru_old_jer_hack" then
+ iso9 = translit.add_table(iso9,
+ translit.ru_old_upp,
+ translit.ru_old_low,
+ translit.ru_jer_hack
+ )
+ end
+
local p_iso9
p_iso9 = addrules (iso9, p_iso9)
diff --git a/tex/context/third/transliterator/trans_tables_scntfc.lua b/tex/context/third/transliterator/trans_tables_scntfc.lua
index d42a970..93bdbb4 100644
--- a/tex/context/third/transliterator/trans_tables_scntfc.lua
+++ b/tex/context/third/transliterator/trans_tables_scntfc.lua
@@ -211,7 +211,7 @@ function translit.scientific (mode, text)
local cyr = {}
local cyruk, p_cyruk, p_cyr
local scientific_parser
- if mode == ("iso9_ocs") then
+ if mode == "iso9_ocs" or mode == "iso9_ocs_hack" then
environment.loadluafile("trans_tables_iso9.lua")
translit.add_table( cyr,
@@ -225,6 +225,12 @@ function translit.scientific (mode, text)
translit.ocs_add_upp
)
+ if mode == "iso9_ocs_hack" then
+ translit.add_table( cyr,
+ translit.ru_jer_hack
+ )
+ end
+
p_cyr = Cs(utfchar) / cyr
scientific_parser = Cs((p_cyr + utfchar)^0)