Add font option to w2l
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@216 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
321d65999c
commit
837b6cf220
27 changed files with 209 additions and 78 deletions
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-09-19)
|
||||
* Version 1.6 (2014-11-12)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -52,6 +52,24 @@ public class LaTeXOptionsDialog extends OptionsDialogBase {
|
|||
private static final String[] FLOATOPTIONS_VALUES =
|
||||
{ "", "tp", "bp", "htp", "hbp" };
|
||||
|
||||
// UI names and configuration option values for fonts
|
||||
private static final String[] FONT_VALUES =
|
||||
{ "default", "cmbright", "ccfonts", "ccfonts-euler",
|
||||
"iwona", "kurier", "anttor", "kmath-kerkis",
|
||||
"millennial", "fouriernc",
|
||||
"pxfonts", "mathpazo", "mathpple",
|
||||
"txfonts", "mathtime", "mathptmx",
|
||||
"mbtimes", "arev",
|
||||
"charter-mathdesign", "garamond-mathdesign", "utopia-mathdesign", "fourier" };
|
||||
private static final String[] FONT_NAMES =
|
||||
{ "Default (Computer Modern)", "CM Bright", "Concrete", "Concrete + Euler Math",
|
||||
"Iwona", "Kurier", "Antykwa Torunska", "Kerkis",
|
||||
"New Century Schoolbook + Millennial Math", "New Century Schoolbook + Fourier Math",
|
||||
"Palatino + PXfonts Math", "Palatino + Pazo Math", "Palatino + Euler Math",
|
||||
"Times + TXfonts Math", "Times + Belleek Math", "Times + Symbol",
|
||||
"Omega Serif + Omega Math", "Arev Sans + Arev Math",
|
||||
"Bitstream Charter + Math Design", "URW Garamond + Math Design", "Utopia + Math Design", "Utopia + Fourier Math" };
|
||||
|
||||
/** The component will be registered under this name.
|
||||
*/
|
||||
public static String __serviceName = "org.openoffice.da.writer2latex.LaTeXOptionsDialog";
|
||||
|
@ -87,6 +105,8 @@ public class LaTeXOptionsDialog extends OptionsDialogBase {
|
|||
loadListBoxOption(xProps,"Backend");
|
||||
loadListBoxOption(xProps,"Inputencoding");
|
||||
loadCheckBoxOption(xProps,"Multilingual");
|
||||
setListBoxStringItemList("Font", FONT_NAMES);
|
||||
loadListBoxOption(xProps,"Font");
|
||||
loadCheckBoxOption(xProps,"GreekMath");
|
||||
loadCheckBoxOption(xProps,"AdditionalSymbols");
|
||||
|
||||
|
@ -145,6 +165,7 @@ public class LaTeXOptionsDialog extends OptionsDialogBase {
|
|||
}
|
||||
saveListBoxOption(xProps, filterData, "Inputencoding", "inputencoding", INPUTENCODING_VALUES);
|
||||
saveCheckBoxOption(xProps, filterData, "Multilingual", "multilingual");
|
||||
saveListBoxOption(xProps, filterData, "Font", "font", FONT_VALUES);
|
||||
saveCheckBoxOption(xProps, filterData, "GreekMath", "greek_math");
|
||||
// AdditionalSymbols sets 5 different w2l options...
|
||||
saveCheckBoxOption(xProps, filterData, "AdditionalSymbols", "use_pifont");
|
||||
|
@ -280,6 +301,7 @@ public class LaTeXOptionsDialog extends OptionsDialogBase {
|
|||
setControlEnabled("InputencodingLabel",!isLocked("inputencoding"));
|
||||
setControlEnabled("Inputencoding",!isLocked("inputencoding"));
|
||||
setControlEnabled("Multilingual",!isLocked("multilingual"));
|
||||
setControlEnabled("Font",!isLocked("font"));
|
||||
setControlEnabled("GreekMath",!isLocked("greek_math"));
|
||||
setControlEnabled("AdditionalSymbols",!isLocked("additional_symbols"));
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-09-16)
|
||||
* Version 1.6 (2014-11-06)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
|||
/////////////////////////////////////////////////////////////////////////
|
||||
// I. Define items needed by ConfigBase
|
||||
|
||||
protected int getOptionCount() { return 71; }
|
||||
protected int getOptionCount() { return 72; }
|
||||
protected String getDefaultConfigPath() { return "/writer2latex/latex/config/"; }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
@ -150,38 +150,39 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
|||
private static final int INCLUDE_ORIGINAL_CITATIONS = 36;
|
||||
private static final int USE_NATBIB = 37;
|
||||
private static final int NATBIB_OPTIONS = 38;
|
||||
private static final int FORMATTING = 39;
|
||||
private static final int PAGE_FORMATTING = 40;
|
||||
private static final int OTHER_STYLES = 41;
|
||||
private static final int IMAGE_CONTENT = 42;
|
||||
private static final int TABLE_CONTENT = 43;
|
||||
private static final int TABLE_FIRST_HEAD_STYLE = 44;
|
||||
private static final int TABLE_HEAD_STYLE = 45;
|
||||
private static final int TABLE_FOOT_STYLE = 46;
|
||||
private static final int TABLE_LAST_FOOT_STYLE = 47;
|
||||
private static final int IGNORE_HARD_PAGE_BREAKS = 48;
|
||||
private static final int IGNORE_HARD_LINE_BREAKS = 49;
|
||||
private static final int IGNORE_EMPTY_PARAGRAPHS =50;
|
||||
private static final int IGNORE_DOUBLE_SPACES = 51;
|
||||
private static final int DISPLAY_HIDDEN_TEXT = 52;
|
||||
private static final int ALIGN_FRAMES = 53;
|
||||
private static final int FLOAT_FIGURES = 54;
|
||||
private static final int FLOAT_TABLES = 55;
|
||||
private static final int FLOAT_OPTIONS = 56;
|
||||
private static final int FIGURE_SEQUENCE_NAME = 57;
|
||||
private static final int TABLE_SEQUENCE_NAME = 58;
|
||||
private static final int IMAGE_OPTIONS = 59;
|
||||
private static final int REMOVE_GRAPHICS_EXTENSION = 60;
|
||||
private static final int ORIGINAL_IMAGE_SIZE = 61;
|
||||
private static final int SIMPLE_TABLE_LIMIT = 62;
|
||||
private static final int NOTES = 63;
|
||||
private static final int METADATA = 64;
|
||||
private static final int TABSTOP = 65;
|
||||
private static final int WRAP_LINES_AFTER = 66;
|
||||
private static final int SPLIT_LINKED_SECTIONS = 67;
|
||||
private static final int SPLIT_TOPLEVEL_SECTIONS = 68;
|
||||
private static final int SAVE_IMAGES_IN_SUBDIR = 69;
|
||||
private static final int DEBUG = 70;
|
||||
private static final int FONT = 39;
|
||||
private static final int FORMATTING = 40;
|
||||
private static final int PAGE_FORMATTING = 41;
|
||||
private static final int OTHER_STYLES = 42;
|
||||
private static final int IMAGE_CONTENT = 43;
|
||||
private static final int TABLE_CONTENT = 44;
|
||||
private static final int TABLE_FIRST_HEAD_STYLE = 45;
|
||||
private static final int TABLE_HEAD_STYLE = 46;
|
||||
private static final int TABLE_FOOT_STYLE = 47;
|
||||
private static final int TABLE_LAST_FOOT_STYLE = 48;
|
||||
private static final int IGNORE_HARD_PAGE_BREAKS = 49;
|
||||
private static final int IGNORE_HARD_LINE_BREAKS = 50;
|
||||
private static final int IGNORE_EMPTY_PARAGRAPHS =51;
|
||||
private static final int IGNORE_DOUBLE_SPACES = 52;
|
||||
private static final int DISPLAY_HIDDEN_TEXT = 53;
|
||||
private static final int ALIGN_FRAMES = 54;
|
||||
private static final int FLOAT_FIGURES = 55;
|
||||
private static final int FLOAT_TABLES = 56;
|
||||
private static final int FLOAT_OPTIONS = 57;
|
||||
private static final int FIGURE_SEQUENCE_NAME = 58;
|
||||
private static final int TABLE_SEQUENCE_NAME = 59;
|
||||
private static final int IMAGE_OPTIONS = 60;
|
||||
private static final int REMOVE_GRAPHICS_EXTENSION = 61;
|
||||
private static final int ORIGINAL_IMAGE_SIZE = 62;
|
||||
private static final int SIMPLE_TABLE_LIMIT = 63;
|
||||
private static final int NOTES = 64;
|
||||
private static final int METADATA = 65;
|
||||
private static final int TABSTOP = 66;
|
||||
private static final int WRAP_LINES_AFTER = 67;
|
||||
private static final int SPLIT_LINKED_SECTIONS = 68;
|
||||
private static final int SPLIT_TOPLEVEL_SECTIONS = 69;
|
||||
private static final int SAVE_IMAGES_IN_SUBDIR = 70;
|
||||
private static final int DEBUG = 71;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// IV. Our options data
|
||||
|
@ -259,6 +260,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
|||
options[INCLUDE_ORIGINAL_CITATIONS] = new BooleanOption("include_original_citations","false");
|
||||
options[USE_NATBIB] = new BooleanOption("use_natbib","false");
|
||||
options[NATBIB_OPTIONS] = new Option("natbib_options","");
|
||||
options[FONT] = new Option("font","default");
|
||||
options[FORMATTING] = new IntegerOption("formatting","convert_basic") {
|
||||
public void setString(String sValue) {
|
||||
super.setString(sValue);
|
||||
|
@ -689,6 +691,7 @@ public class LaTeXConfig extends writer2latex.base.ConfigBase {
|
|||
public String getNatbibOptions() { return options[NATBIB_OPTIONS].getString(); }
|
||||
|
||||
// Formatting options
|
||||
public String getFont() { return options[FONT].getString(); }
|
||||
public int formatting() { return ((IntegerOption) options[FORMATTING]).getValue(); }
|
||||
public int pageFormatting() { return ((IntegerOption) options[PAGE_FORMATTING]).getValue(); }
|
||||
public int otherStyles() { return ((IntegerOption) options[OTHER_STYLES]).getValue(); }
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.4 (2014-09-16)
|
||||
* Version 1.6 (2014-11-12)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -303,6 +303,9 @@ public class ClassicI18n extends I18n {
|
|||
fontencs.addValue("T1");
|
||||
pack.append("\\usepackage[").append(fontencs.toString())
|
||||
.append("]{fontenc}").nl();
|
||||
|
||||
// use font package(s)
|
||||
useFontPackages(pack);
|
||||
|
||||
// usepackage babel
|
||||
|
||||
|
@ -394,6 +397,76 @@ public class ClassicI18n extends I18n {
|
|||
|
||||
}
|
||||
|
||||
private void useFontPackages(LaTeXDocumentPortion ldp) {
|
||||
String sFont = config.getFont();
|
||||
// Sources:
|
||||
// A Survey of Free Math Fonts for TeX and LaTeX, Stephen G. Hartke 2006
|
||||
if ("cmbright".equals(sFont)) { // Computer Modern Bright designed by Walter A. Schmidt
|
||||
ldp.append("\\usepackage{cmbright}").nl();
|
||||
}
|
||||
else if ("ccfonts".equals(sFont)) { // Concrete designed by Donald E. Knuth
|
||||
ldp.append("\\usepackage{ccfonts}").nl();
|
||||
}
|
||||
else if ("ccfonts-euler".equals(sFont)) { // Concrete with Euler math fonts
|
||||
ldp.append("\\usepackage{ccfonts,eulervm}").nl();
|
||||
}
|
||||
else if ("iwona".equals(sFont)) { // Iwona
|
||||
ldp.append("\\usepackage[math]{iwona}").nl();
|
||||
}
|
||||
else if ("kurier".equals(sFont)) { // Kurier
|
||||
ldp.append("\\usepackage[math]{kurier}").nl();
|
||||
}
|
||||
else if ("anttor".equals(sFont)) { // Antykwa Torunska
|
||||
ldp.append("\\usepackage[math]{anttor}").nl();
|
||||
}
|
||||
else if ("kmath-kerkis".equals(sFont)) { // Kerkis
|
||||
ldp.append("\\usepackage{kmath,kerkis}");
|
||||
}
|
||||
else if ("millennial".equals(sFont)) { // New Century Schoolbook + Millennial
|
||||
ldp.append("\\usepackage{millennial}");
|
||||
}
|
||||
else if ("fouriernc".equals(sFont)) { // New Century Schoolbook + Fourier
|
||||
ldp.append("\\usepackage{fouriernc}");
|
||||
}
|
||||
else if ("pxfonts".equals(sFont)) { // Palatino + pxfonts math
|
||||
ldp.append("\\usepackage{pxfonts}");
|
||||
}
|
||||
else if ("mathpazo".equals(sFont)) { // Palatino + Pazo math
|
||||
ldp.append("\\usepackage{mathpazo}");
|
||||
}
|
||||
else if ("mathpple".equals(sFont)) { // Palatino + Euler
|
||||
ldp.append("\\usepackage{mathpple}");
|
||||
}
|
||||
else if ("txfonts".equals(sFont)) { // Times + txfonts math
|
||||
ldp.append("\\usepackage[varg]{txfonts}");
|
||||
}
|
||||
else if ("mathtime".equals(sFont)) { // Times + Beleek math
|
||||
ldp.append("\\usepackage{mathtime}");
|
||||
}
|
||||
else if ("mathptmx".equals(sFont)) { // Times + Symbol
|
||||
ldp.append("\\usepackage{mathptmx}");
|
||||
}
|
||||
else if ("mbtimes".equals(sFont)) { // Omega serif + Omega math
|
||||
ldp.append("\\usepackage{mbtimes}");
|
||||
}
|
||||
else if ("arev".equals(sFont)) { // Arev Sans + Arev math
|
||||
ldp.append("\\usepackage{arev}");
|
||||
}
|
||||
else if ("charter-mathdesign".equals(sFont)) { // Bitstream Charter + Math Design
|
||||
ldp.append("\\usepackage[charter]{mathdesign}");
|
||||
}
|
||||
else if ("garamond-mathdesign".equals(sFont)) { // URW Garamond + Math Design
|
||||
ldp.append("\\usepackage[garamond]{mathdesign}");
|
||||
}
|
||||
else if ("utopia-mathdesign".equals(sFont)) { // Utopia + Math Design
|
||||
ldp.append("\\usepackage[utopia]{mathdesign}");
|
||||
}
|
||||
else if ("fourier".equals(sFont)) { // Utopia + Fourier
|
||||
ldp.append("\\usepackage{fourier}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Apply a language language
|
||||
* @param style the OOo style to read attributes from
|
||||
* @param bDecl true if declaration form is required
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue