Jskad now ships with both TibetanMachine and TibetanMachineWeb fonts
by default, not just TMW. Thus users need not install these fonts on their systems.
This commit is contained in:
parent
9effee0564
commit
a463b686b3
5 changed files with 46 additions and 41 deletions
|
@ -287,11 +287,9 @@
|
|||
<antcall target="copy-tmw-fonts-to-bin-dir">
|
||||
<param name="my.bin" value="${jskadbin}"/>
|
||||
</antcall>
|
||||
<!-- DLC FIMXE: put these in Jskad
|
||||
<antcall target="copy-tm-fonts-to-bin-dir">
|
||||
<param name="my.bin" value="${jskadbin}"/>
|
||||
</antcall>
|
||||
-->
|
||||
<antcall target="create-timestamp-source-code"/> <!-- DLC NOW! The -run targets are mucking with this! It isn't fatal, but it should be fixed. -->
|
||||
<antcall target="our-internal-javac-task">
|
||||
<param name="mybin" value="${jskadbin}"/>
|
||||
|
|
|
@ -43,6 +43,11 @@ thdl.Jskad.working.directory =
|
|||
# faster.
|
||||
thdl.rely.on.system.tmw.fonts = false
|
||||
|
||||
# Should the TibetanMachine fonts not be loaded from within the JAR? Set
|
||||
# this to true if you can get away with it and want your THDL tools to load
|
||||
# faster. Note that TibetanMachine is not the default font for Jskad.
|
||||
thdl.rely.on.system.tm.fonts = false
|
||||
|
||||
# Sets the Tibetan keyboard that Jskad uses on startup.
|
||||
# Here are the acceptable values:
|
||||
#
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ConverterGUI implements FontConversion, FontConverterConstants {
|
|||
public static void main(String[] args) {
|
||||
// No need for the TM or TMW fonts.
|
||||
System.setProperty("thdl.rely.on.system.tmw.fonts", "true");
|
||||
System.setProperty("thdl.do.not.rely.on.system.tm.fonts", "false");
|
||||
System.setProperty("thdl.rely.on.system.tm.fonts", "true");
|
||||
|
||||
System.exit(realMain(args, System.out, null));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TibetanConverter implements FontConverterConstants {
|
|||
static {
|
||||
// No need for the TM or TMW fonts.
|
||||
System.setProperty("thdl.rely.on.system.tmw.fonts", "true");
|
||||
System.setProperty("thdl.do.not.rely.on.system.tm.fonts", "false");
|
||||
System.setProperty("thdl.rely.on.system.tm.fonts", "true");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.thdl.tib.text.tshegbar.UnicodeCodepointToThdlWylie;
|
|||
* both or neither.
|
||||
*
|
||||
* <p>In addition, this class optionally loads the TibetanMachineWeb
|
||||
* fonts manually via {@link #readInFontFiles()}.
|
||||
* fonts manually via {@link #readInTMWFontFiles()}.
|
||||
* @author Edward Garrett, Tibetan and Himalayan Digital Library
|
||||
* @version 1.0
|
||||
*/
|
||||
|
@ -195,40 +195,46 @@ public class TibetanMachineWeb implements THDLWylieConstants {
|
|||
setKeyboard(keyboard);
|
||||
}
|
||||
|
||||
/** Assumes that the TMW font files are resources associated with
|
||||
* this class and loads those font files.
|
||||
* @throws Error if that assumption does not hold */
|
||||
private static void readInFontFiles() {
|
||||
/** If the TMW font files are resources associated with this
|
||||
* class, those font files are loaded. This means that the user
|
||||
* need not install the fonts on their system, but it does make
|
||||
* the JAR bigger and takes time at startup.
|
||||
* @return true upon successful loading, false otherwise */
|
||||
private static boolean readInTMWFontFiles() {
|
||||
/* Note the leading slashes on these paths: */
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn1.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn2.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn3.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn4.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn5.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn6.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn7.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn8.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn9.ttf");
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn1.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn2.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn3.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn4.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn5.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn6.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn7.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn8.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn9.ttf")) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Assumes that the TM font files are resources associated with
|
||||
* this class and loads those font files.
|
||||
* @throws Error if that assumption does not hold */
|
||||
private static void readInTMFontFiles() {
|
||||
/** If the TM font files are resources associated with this
|
||||
* class, those font files are loaded. This means that the user
|
||||
* need not install the fonts on their system, but it does make
|
||||
* the JAR bigger and takes time at startup.
|
||||
* @return true upon successful loading, false otherwise */
|
||||
private static boolean readInTMFontFiles() {
|
||||
/* Note the leading slashes on these paths: */
|
||||
readInFontFile("/Fonts/TibetanMachine/Timn.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachine/Tims1.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachine/Tims2.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachine/Tims3.ttf");
|
||||
readInFontFile("/Fonts/TibetanMachine/Tims4.ttf");
|
||||
if (!readInFontFile("/Fonts/TibetanMachine/Timn.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachine/Tims1.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachine/Tims2.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachine/Tims3.ttf")) return false;
|
||||
if (!readInFontFile("/Fonts/TibetanMachine/Tims4.ttf")) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Assumes that the TMW font file at the given path is a resource
|
||||
* associated with this class and loads that font file.
|
||||
/** If the TMW font file at the given path is a resource
|
||||
* associated with this class, that font file is loaded.
|
||||
* @param path a path within the JAR containing this class file
|
||||
* @throws Error if that assumption does not hold */
|
||||
private static void readInFontFile(String path) {
|
||||
* @return true upon successful loading, false otherwise */
|
||||
private static boolean readInFontFile(String path) {
|
||||
|
||||
// Note that the TM and TMW fonts do not have hanging
|
||||
// baselines. They have Roman baselines. Tony Duff said this
|
||||
|
@ -238,14 +244,15 @@ public class TibetanMachineWeb implements THDLWylieConstants {
|
|||
try {
|
||||
InputStream is = TibetanMachineWeb.class.getResourceAsStream(path);
|
||||
if (null == is) {
|
||||
throw new Error("You selected the optional behavior of loading the TibetanMachineWeb font family manually, but the resource "
|
||||
+ path + " could not be found.");
|
||||
return false;
|
||||
}
|
||||
Font.createFont(Font.TRUETYPE_FONT, is);
|
||||
} catch( Exception e ) {
|
||||
e.printStackTrace();
|
||||
ThdlDebug.noteIffyCode();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Returns the next token in st with the first occurrence of
|
||||
|
@ -272,14 +279,9 @@ public class TibetanMachineWeb implements THDLWylieConstants {
|
|||
*/
|
||||
private static void readData() {
|
||||
if (!ThdlOptions.getBooleanOption("thdl.rely.on.system.tmw.fonts")) {
|
||||
readInFontFiles();
|
||||
readInTMWFontFiles();
|
||||
}
|
||||
|
||||
// DLC FIXME: include TM fonts with Jskad but not with other
|
||||
// packages. Right now you can get them manually by editing
|
||||
// build.xml and your options.txt or my_thdl_preferences.txt
|
||||
// file.
|
||||
if (ThdlOptions.getBooleanOption("thdl.do.not.rely.on.system.tm.fonts")) {
|
||||
if (!ThdlOptions.getBooleanOption("thdl.rely.on.system.tm.fonts")) {
|
||||
readInTMFontFiles();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue