ACIP font shrinking as in {KA (GA)} is now supported.
This commit is contained in:
parent
07e360d9a8
commit
d8657abd44
3 changed files with 33 additions and 5 deletions
|
@ -143,10 +143,6 @@ public class ACIPConverter {
|
|||
throws IOException
|
||||
{
|
||||
TibetanDocument tdoc = new TibetanDocument();
|
||||
tdoc.setRomanAttributeSet(ThdlOptions.getStringOption("thdl.acip.to.x.latin.font",
|
||||
"Courier New"),
|
||||
ThdlOptions.getIntegerOption("thdl.acip.to.x.latin.font.size",
|
||||
20));
|
||||
boolean rv
|
||||
= convertToTMW(scan, tdoc, errors, warnings,
|
||||
writeWarningsToResult, warningLevel, colors);
|
||||
|
@ -194,7 +190,7 @@ public class ACIPConverter {
|
|||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (IOException e) {
|
||||
throw new Error(e.toString());
|
||||
}
|
||||
}
|
||||
|
@ -258,6 +254,23 @@ public class ACIPConverter {
|
|||
boolean colors)
|
||||
throws IOException
|
||||
{
|
||||
int smallFontSize = -1;
|
||||
int regularFontSize = -1;
|
||||
if (null != tdoc) {
|
||||
String latinFont
|
||||
= ThdlOptions.getStringOption("thdl.acip.to.x.latin.font",
|
||||
"Courier New");
|
||||
int latinFontSize
|
||||
= ThdlOptions.getIntegerOption("thdl.acip.to.x.latin.font.size",
|
||||
20);
|
||||
tdoc.setRomanAttributeSet(latinFont, latinFontSize);
|
||||
|
||||
regularFontSize = tdoc.getTibetanFontSize();
|
||||
smallFontSize = (int)(0.75*regularFontSize);
|
||||
if (smallFontSize >= regularFontSize)
|
||||
smallFontSize = regularFontSize - 1;
|
||||
}
|
||||
|
||||
if (colors)
|
||||
tdoc.enableColors();
|
||||
else
|
||||
|
@ -481,6 +494,16 @@ public class ACIPConverter {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (stype == ACIPString.START_PAREN) {
|
||||
if (null != tdoc) {
|
||||
tdoc.setTibetanFontSize(smallFontSize);
|
||||
}
|
||||
continue;
|
||||
} else if (stype == ACIPString.END_PAREN) {
|
||||
if (null != tdoc) {
|
||||
tdoc.setTibetanFontSize(regularFontSize);
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
throw new Error("forgot a case");
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ public class ACIPString {
|
|||
public static boolean isLatin(int type) {
|
||||
return (type != TIBETAN_NON_PUNCTUATION
|
||||
&& type != TIBETAN_PUNCTUATION
|
||||
&& type != TSHEG_BAR_ADORNMENT
|
||||
&& type != START_PAREN
|
||||
&& type != END_PAREN
|
||||
&& type != START_SLASH
|
||||
&& type != END_SLASH);
|
||||
}
|
||||
|
|
|
@ -7083,6 +7083,8 @@ tstHelper("ZUR");
|
|||
|
||||
/** Tests {@link ACIPTshegBarScanner#scan(String, StringBuffer, int)}. */
|
||||
public void testScanner() {
|
||||
shelp("KA (KHA\nGA)", "", "[TIBETAN_NON_PUNCTUATION:{KA}, TIBETAN_PUNCTUATION:{ }, START_PAREN:{(}, TIBETAN_NON_PUNCTUATION:{KHA}, TIBETAN_PUNCTUATION:{ }, TIBETAN_NON_PUNCTUATION:{GA}, END_PAREN:{)}]");
|
||||
|
||||
shelp("LA...SGRUB",
|
||||
"",
|
||||
"[TIBETAN_NON_PUNCTUATION:{LA}, TIBETAN_PUNCTUATION:{.}, TIBETAN_PUNCTUATION:{.}, TIBETAN_PUNCTUATION:{.}, TIBETAN_NON_PUNCTUATION:{SGRUB}]");
|
||||
|
|
Loading…
Reference in a new issue