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">
|
<antcall target="copy-tmw-fonts-to-bin-dir">
|
||||||
<param name="my.bin" value="${jskadbin}"/>
|
<param name="my.bin" value="${jskadbin}"/>
|
||||||
</antcall>
|
</antcall>
|
||||||
<!-- DLC FIMXE: put these in Jskad
|
|
||||||
<antcall target="copy-tm-fonts-to-bin-dir">
|
<antcall target="copy-tm-fonts-to-bin-dir">
|
||||||
<param name="my.bin" value="${jskadbin}"/>
|
<param name="my.bin" value="${jskadbin}"/>
|
||||||
</antcall>
|
</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="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">
|
<antcall target="our-internal-javac-task">
|
||||||
<param name="mybin" value="${jskadbin}"/>
|
<param name="mybin" value="${jskadbin}"/>
|
||||||
|
|
|
@ -43,6 +43,11 @@ thdl.Jskad.working.directory =
|
||||||
# faster.
|
# faster.
|
||||||
thdl.rely.on.system.tmw.fonts = false
|
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.
|
# Sets the Tibetan keyboard that Jskad uses on startup.
|
||||||
# Here are the acceptable values:
|
# Here are the acceptable values:
|
||||||
#
|
#
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ConverterGUI implements FontConversion, FontConverterConstants {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// No need for the TM or TMW fonts.
|
// No need for the TM or TMW fonts.
|
||||||
System.setProperty("thdl.rely.on.system.tmw.fonts", "true");
|
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));
|
System.exit(realMain(args, System.out, null));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TibetanConverter implements FontConverterConstants {
|
||||||
static {
|
static {
|
||||||
// No need for the TM or TMW fonts.
|
// No need for the TM or TMW fonts.
|
||||||
System.setProperty("thdl.rely.on.system.tmw.fonts", "true");
|
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.
|
* both or neither.
|
||||||
*
|
*
|
||||||
* <p>In addition, this class optionally loads the TibetanMachineWeb
|
* <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
|
* @author Edward Garrett, Tibetan and Himalayan Digital Library
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
@ -195,40 +195,46 @@ public class TibetanMachineWeb implements THDLWylieConstants {
|
||||||
setKeyboard(keyboard);
|
setKeyboard(keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Assumes that the TMW font files are resources associated with
|
/** If the TMW font files are resources associated with this
|
||||||
* this class and loads those font files.
|
* class, those font files are loaded. This means that the user
|
||||||
* @throws Error if that assumption does not hold */
|
* need not install the fonts on their system, but it does make
|
||||||
private static void readInFontFiles() {
|
* 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: */
|
/* Note the leading slashes on these paths: */
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn1.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn1.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn2.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn2.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn3.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn3.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn4.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn4.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn5.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn5.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn6.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn6.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn7.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn7.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn8.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn8.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachineWeb/timwn9.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachineWeb/timwn9.ttf")) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Assumes that the TM font files are resources associated with
|
/** If the TM font files are resources associated with this
|
||||||
* this class and loads those font files.
|
* class, those font files are loaded. This means that the user
|
||||||
* @throws Error if that assumption does not hold */
|
* need not install the fonts on their system, but it does make
|
||||||
private static void readInTMFontFiles() {
|
* 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: */
|
/* Note the leading slashes on these paths: */
|
||||||
readInFontFile("/Fonts/TibetanMachine/Timn.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachine/Timn.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachine/Tims1.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachine/Tims1.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachine/Tims2.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachine/Tims2.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachine/Tims3.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachine/Tims3.ttf")) return false;
|
||||||
readInFontFile("/Fonts/TibetanMachine/Tims4.ttf");
|
if (!readInFontFile("/Fonts/TibetanMachine/Tims4.ttf")) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Assumes that the TMW font file at the given path is a resource
|
/** If the TMW font file at the given path is a resource
|
||||||
* associated with this class and loads that font file.
|
* associated with this class, that font file is loaded.
|
||||||
* @param path a path within the JAR containing this class file
|
* @param path a path within the JAR containing this class file
|
||||||
* @throws Error if that assumption does not hold */
|
* @return true upon successful loading, false otherwise */
|
||||||
private static void readInFontFile(String path) {
|
private static boolean readInFontFile(String path) {
|
||||||
|
|
||||||
// Note that the TM and TMW fonts do not have hanging
|
// Note that the TM and TMW fonts do not have hanging
|
||||||
// baselines. They have Roman baselines. Tony Duff said this
|
// baselines. They have Roman baselines. Tony Duff said this
|
||||||
|
@ -238,14 +244,15 @@ public class TibetanMachineWeb implements THDLWylieConstants {
|
||||||
try {
|
try {
|
||||||
InputStream is = TibetanMachineWeb.class.getResourceAsStream(path);
|
InputStream is = TibetanMachineWeb.class.getResourceAsStream(path);
|
||||||
if (null == is) {
|
if (null == is) {
|
||||||
throw new Error("You selected the optional behavior of loading the TibetanMachineWeb font family manually, but the resource "
|
return false;
|
||||||
+ path + " could not be found.");
|
|
||||||
}
|
}
|
||||||
Font.createFont(Font.TRUETYPE_FONT, is);
|
Font.createFont(Font.TRUETYPE_FONT, is);
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
ThdlDebug.noteIffyCode();
|
ThdlDebug.noteIffyCode();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the next token in st with the first occurrence of
|
/** Returns the next token in st with the first occurrence of
|
||||||
|
@ -272,14 +279,9 @@ public class TibetanMachineWeb implements THDLWylieConstants {
|
||||||
*/
|
*/
|
||||||
private static void readData() {
|
private static void readData() {
|
||||||
if (!ThdlOptions.getBooleanOption("thdl.rely.on.system.tmw.fonts")) {
|
if (!ThdlOptions.getBooleanOption("thdl.rely.on.system.tmw.fonts")) {
|
||||||
readInFontFiles();
|
readInTMWFontFiles();
|
||||||
}
|
}
|
||||||
|
if (!ThdlOptions.getBooleanOption("thdl.rely.on.system.tm.fonts")) {
|
||||||
// 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")) {
|
|
||||||
readInTMFontFiles();
|
readInTMFontFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue