diff --git a/source/options.txt b/source/options.txt index 2e3468e..aa54978 100644 --- a/source/options.txt +++ b/source/options.txt @@ -73,6 +73,11 @@ thdl.Jskad.initial.status.message = Welcome to Jskad\! # not be saved if this is true.) thdl.Jskad.do.not.confirm.quit = false +# If this is false, then upon opening any RTF document, Jskad will +# replace the characters '{', '}', and '\' in the font 'Tahoma' with +# the correct Tibetan Machine Web glyphs. +thdl.Jskad.do.not.fix.curly.braces.in.rtf = false + ############################################################################ ####################### Developer Preferences ######################## diff --git a/source/org/thdl/tib/input/Jskad.java b/source/org/thdl/tib/input/Jskad.java index b3b8326..2d8f6d7 100644 --- a/source/org/thdl/tib/input/Jskad.java +++ b/source/org/thdl/tib/input/Jskad.java @@ -695,6 +695,9 @@ public class Jskad extends JPanel implements DocumentListener { newFrame.dispose(); numberOfTibsRTFOpen--; } else { + if (!ThdlOptions.getBooleanOption("thdl.Jskad.do.not.fix.curly.braces.in.rtf")) { + ((TibetanDocument)newRTF.dp.getDocument()).replaceTahomaCurlyBracesAndBackslashes(0, -1); + } newRTF.dp.getDocument().addDocumentListener(newRTF); newFrame.setTitle("Jskad: " + f_name); newRTF.fileName = new String(f_name); @@ -718,6 +721,9 @@ public class Jskad extends JPanel implements DocumentListener { in.close(); if (!error) { + if (!ThdlOptions.getBooleanOption("thdl.Jskad.do.not.fix.curly.braces.in.rtf")) { + ((TibetanDocument)dp.getDocument()).replaceTahomaCurlyBracesAndBackslashes(0, -1); + } dp.getCaret().setDot(0); dp.getDocument().addDocumentListener(Jskad.this); hasChanged = false; diff --git a/source/org/thdl/tib/input/TMW_RTF_TO_THDL_WYLIETest1ResultConversion.expected b/source/org/thdl/tib/input/TMW_RTF_TO_THDL_WYLIETest1ResultConversion.expected index 25d3ec5..68a6398 100644 --- a/source/org/thdl/tib/input/TMW_RTF_TO_THDL_WYLIETest1ResultConversion.expected +++ b/source/org/thdl/tib/input/TMW_RTF_TO_THDL_WYLIETest1ResultConversion.expected @@ -4,7 +4,7 @@ \margl1440\margr1440\widowctrl \s1\li0\ri0\fi0\ql\f2\fs28\i0\b0\cf0 bod kyi deb ther dpyid kyi rgyal mo'i glu dbyangs/\f3\fs44\ul0\par \par -\f2\fs28\ul0 @#/_\f4\fs44\ul0 \f2\fs28\ul0 /gangs can yul gyi sa la spyod pa'i mtho ris kyi rgyal blon gtso bor brjod pa'i deb ther rdzogs ldan gzhon nu'i dga' ston dpyid kyi rgyal mo'i glu dbyangs zhes bya ba bzhugs so//\par +\f2\fs28\ul0 @#$/_\f4\fs44\ul0 \f2\fs28\ul0 /gangs can yul gyi sa la spyod pa'i mtho ris kyi rgyal blon gtso bor brjod pa'i deb ther rdzogs ldan gzhon nu'i dga' ston dpyid kyi rgyal mo'i glu dbyangs zhes bya ba bzhugs so//\par \par bskal pa bzang po'i blta na sdug pa'i grong khyer dbus na 'jigs bral snying stobs gser gyi gdan khri la//\par grags snyan nor bu'i rna rgyan 'od gzi mngon par rab 'bar chos kun ma lus gzigs pa'i mig stong can//\par diff --git a/source/org/thdl/tib/text/TibetanDocument.java b/source/org/thdl/tib/text/TibetanDocument.java index e195d63..7ced0df 100644 --- a/source/org/thdl/tib/text/TibetanDocument.java +++ b/source/org/thdl/tib/text/TibetanDocument.java @@ -131,8 +131,12 @@ public class TibetanDocument extends DefaultStyledDocument { * @see #setTibetanFontSize(int size) */ public void appendDuff(int offset, String s, MutableAttributeSet attr) { + appendDuff(tibetanFontSize, offset, s, attr); + } + + private void appendDuff(int fontSize, int offset, String s, MutableAttributeSet attr) { try { - StyleConstants.setFontSize(attr, tibetanFontSize); + StyleConstants.setFontSize(attr, fontSize); insertString(offset, s, attr); } catch (BadLocationException ble) { @@ -146,13 +150,17 @@ public class TibetanDocument extends DefaultStyledDocument { * @param pos the position at which you want to insert text */ public int insertDuff(int pos, DuffData[] glyphs) { + return insertDuff(tibetanFontSize, pos, glyphs); + } + + private int insertDuff(int fontSize, int pos, DuffData[] glyphs) { if (glyphs == null) return pos; MutableAttributeSet mas; for (int i=0; i -_, ,/,|,!,:,;,@,#,$,%,(,),H,M,`,& +_, ,/,|,!,:,;,@,#,$,%,(,),H,M,`,&,@# //_~32,1~0,32 @@ -43,6 +43,7 @@ H~239,1~~8,92~~~~~~~0F7F M~~~8,91~~~~~~~0F7E `~241,1~~8,94~~~~~~~0F83 &~177,4~~8,93~~~~~~~0F85 +@#~201,1~~9,40 Dz~146,5~~10,42 @@ -996,7 +997,7 @@ mnyam.yig.mgo.rgyan~36,5~~9,36~~~~~~~0F09 37,5~~9,37 zla tse gcig~210,1~~9,38~~~~~~~0F04 half zla tse gcig~200,1~~9,39~~~~~~~0F05 -zla tse gnyis~201,1~~9,40 +// zla tse gnyis~201,1~~9,40 is now punctuation. yig.mgo.phur.shad~38,5~~9,41~~~~~~~0F06 Yig.mgo.tsheg.shad~39,5~~9,42~~~~~~~0F07