By default (controllable via options.txt), Jskad now fixes the Tahoma curly

brace problem upon opening any RTF document.

The TMW_RTF_TO_THDL_WYLIE test baselines changed because
I fixed (a while ago) some inconsistencies between the EWTS standard and
Jskad.

Conversion of TibetanMachineWeb8.40, @#, to Wylie now works correctly.

Unfortunately, though, typing @# doesn't produce 8.40, it still produces
8.38 and 8.39, two glyphs.
This commit is contained in:
dchandler 2003-05-28 00:40:59 +00:00
parent a144b125ca
commit 6f0390c5d6
5 changed files with 32 additions and 6 deletions

View file

@ -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 ########################

View file

@ -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;

View file

@ -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

View file

@ -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<glyphs.length; i++) {
mas = TibetanMachineWeb.getAttributeSet(glyphs[i].font);
appendDuff(pos, glyphs[i].text, mas);
appendDuff(fontSize, pos, glyphs[i].text, mas);
pos += glyphs[i].text.length();
}
return pos;
@ -368,7 +376,13 @@ public class TibetanDocument extends DefaultStyledDocument {
break;
}
if (null != toReplaceWith) {
insertDuff(i, toReplaceWith);
int fontSize = tibetanFontSize;
try {
fontSize = ((Integer)getCharacterElement(i).getAttributes().getAttribute(StyleConstants.FontSize)).intValue();
} catch (Exception e) {
// leave it as tibetanFontSize
}
insertDuff(fontSize, i, toReplaceWith);
remove(i+1, 1);
}
}

View file

@ -21,7 +21,7 @@ k,kh,g,ng,c,ch,j,ny,t,th,d,n,p,ph,b,m,ts,tsh,dz,w,zh,z,',y,r,l,sh,s,h,a,T,Th,D,N
a,i,u,e,o,I,U,ai,au,A,-i,-I
<?Other?>
_, ,/,|,!,:,;,@,#,$,%,(,),H,M,`,&
_, ,/,|,!,:,;,@,#,$,%,(,),H,M,`,&,@#
<?Input:Punctuation?>
//_~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
<?Input:Tibetan?>
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