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
|
throws IOException
|
||||||
{
|
{
|
||||||
TibetanDocument tdoc = new TibetanDocument();
|
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
|
boolean rv
|
||||||
= convertToTMW(scan, tdoc, errors, warnings,
|
= convertToTMW(scan, tdoc, errors, warnings,
|
||||||
writeWarningsToResult, warningLevel, colors);
|
writeWarningsToResult, warningLevel, colors);
|
||||||
|
@ -194,7 +190,7 @@ public class ACIPConverter {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (IOException e) {
|
||||||
throw new Error(e.toString());
|
throw new Error(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -258,6 +254,23 @@ public class ACIPConverter {
|
||||||
boolean colors)
|
boolean colors)
|
||||||
throws IOException
|
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)
|
if (colors)
|
||||||
tdoc.enableColors();
|
tdoc.enableColors();
|
||||||
else
|
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 {
|
} else {
|
||||||
throw new Error("forgot a case");
|
throw new Error("forgot a case");
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,9 @@ public class ACIPString {
|
||||||
public static boolean isLatin(int type) {
|
public static boolean isLatin(int type) {
|
||||||
return (type != TIBETAN_NON_PUNCTUATION
|
return (type != TIBETAN_NON_PUNCTUATION
|
||||||
&& type != TIBETAN_PUNCTUATION
|
&& type != TIBETAN_PUNCTUATION
|
||||||
|
&& type != TSHEG_BAR_ADORNMENT
|
||||||
|
&& type != START_PAREN
|
||||||
|
&& type != END_PAREN
|
||||||
&& type != START_SLASH
|
&& type != START_SLASH
|
||||||
&& type != END_SLASH);
|
&& type != END_SLASH);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7083,6 +7083,8 @@ tstHelper("ZUR");
|
||||||
|
|
||||||
/** Tests {@link ACIPTshegBarScanner#scan(String, StringBuffer, int)}. */
|
/** Tests {@link ACIPTshegBarScanner#scan(String, StringBuffer, int)}. */
|
||||||
public void testScanner() {
|
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",
|
shelp("LA...SGRUB",
|
||||||
"",
|
"",
|
||||||
"[TIBETAN_NON_PUNCTUATION:{LA}, TIBETAN_PUNCTUATION:{.}, TIBETAN_PUNCTUATION:{.}, TIBETAN_PUNCTUATION:{.}, TIBETAN_NON_PUNCTUATION:{SGRUB}]");
|
"[TIBETAN_NON_PUNCTUATION:{LA}, TIBETAN_PUNCTUATION:{.}, TIBETAN_PUNCTUATION:{.}, TIBETAN_PUNCTUATION:{.}, TIBETAN_NON_PUNCTUATION:{SGRUB}]");
|
||||||
|
|
Loading…
Reference in a new issue