mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
More fonts in mathed.
Please test. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2632 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dcc9fe59dd
commit
0cf717d0c8
114
development/tools/generate_symbols_list.py
Normal file
114
development/tools/generate_symbols_list.py
Normal file
@ -0,0 +1,114 @@
|
||||
#!/usr/bin/python
|
||||
import sys,string,re,os
|
||||
|
||||
def is_prefix(a, b):
|
||||
return a[:len(b)] == b
|
||||
|
||||
def get_code(code, font):
|
||||
if code < 10:
|
||||
return code+161
|
||||
elif code < 32:
|
||||
return code+163
|
||||
else:
|
||||
return code
|
||||
|
||||
font_names = {}
|
||||
symbols = {}
|
||||
xsymbols = {}
|
||||
|
||||
ignore_list = ["not", "braceld", "bracerd", "bracelu", "braceru",
|
||||
"lmoustache", "rmoustache", "lgroup", "rgroup", "bracevert"]
|
||||
|
||||
def process(file):
|
||||
fh = open(file)
|
||||
lines = fh.readlines()
|
||||
fh.close()
|
||||
|
||||
n = len(lines)
|
||||
for i in xrange(n):
|
||||
line = lines[i]
|
||||
next_line = ""
|
||||
if i+1 < n:
|
||||
next_line = lines[i+1]
|
||||
|
||||
# some entries are spread over two lines so we join the next line
|
||||
# to the current one, (if current line contains a comment, we remove it)
|
||||
line = string.split(line,'%')[0]+next_line
|
||||
|
||||
mo = re.match(r'.*\\DeclareSymbolFont\s*\{(.*?)\}\s*\{(.*?)\}\s*\{(.*?)\}.*', line)
|
||||
if mo != None:
|
||||
font_names[mo.group(1)] = mo.group(3)
|
||||
|
||||
mo = re.match(r'.*\\DeclareMath(Symbol|Delimiter)\s*\{?\\(\w*?)\}?\s*\{?\\(.*?)\}?\s*\{(.*?)\}\s*\{"(.*?)\}.*', line)
|
||||
if mo != None:
|
||||
symbol = mo.group(2)
|
||||
type = mo.group(3)
|
||||
font = mo.group(4)
|
||||
code = mo.group(5)
|
||||
else:
|
||||
mo = re.match(r'.*\\edef\\(\w*?)\{.*?\{\\hexnumber@\\sym(.*?)\}(.*?)\}', line)
|
||||
if mo != None:
|
||||
symbol = mo.group(1)
|
||||
type = "mathord"
|
||||
font = mo.group(2)
|
||||
code = mo.group(3)
|
||||
|
||||
if mo != None and symbol not in ignore_list:
|
||||
mo2 = re.match(r'\s*\\def\\(.*?)\{', next_line)
|
||||
if mo2 != None and is_prefix(symbol,mo2.group(1)):
|
||||
sys.stderr.write("%s -> %s\n" % (symbol, mo2.group(1)))
|
||||
symbol = mo2.group(1)
|
||||
|
||||
if font_names.has_key(font):
|
||||
font = font_names[font]
|
||||
|
||||
code = get_code(string.atoi(code, 16), font)
|
||||
if code == 0:
|
||||
continue
|
||||
|
||||
xcode = 0
|
||||
if xsymbols.has_key(symbol):
|
||||
xcode = xsymbols[symbol]
|
||||
del xsymbols[symbol]
|
||||
|
||||
if symbols.has_key(symbol):
|
||||
sys.stderr.write(symbol+ " exists\n")
|
||||
if code != symbols[symbol]:
|
||||
sys.stderr.write("code is not equal!!!\n")
|
||||
else:
|
||||
symbols[symbol] = code
|
||||
print "%-18s %-4s %3d %3d %-6s" % (symbol,font,code,xcode,type)
|
||||
|
||||
|
||||
path = os.path.split(sys.argv[0])[0]
|
||||
fh = open(os.path.join(path, "x-font"))
|
||||
lines = fh.readlines()
|
||||
fh.close()
|
||||
for line in lines:
|
||||
x = string.split(line)
|
||||
symbol = x[0]
|
||||
code = string.atoi(x[1],16)
|
||||
xsymbols[symbol] = code
|
||||
|
||||
for file in sys.argv[1:]:
|
||||
print "# Generated from " + os.path.basename(file) + "\n"
|
||||
process(file)
|
||||
print
|
||||
|
||||
exceptions = [
|
||||
("neq", "none", 0, 185, "mathrel"),
|
||||
("textdegree", "none", 0, 176, "mathord"),
|
||||
("cong", "none", 0, 64, "mathrel"),
|
||||
("surd", "note", 0, 214, "mathord")
|
||||
]
|
||||
|
||||
if xsymbols.has_key("leq"):
|
||||
sys.exit(0)
|
||||
|
||||
for x in exceptions:
|
||||
print "%-18s %-4s %3d %3d %-6s" % x
|
||||
if xsymbols.has_key(x[0]):
|
||||
del xsymbols[x[0]]
|
||||
|
||||
for symbol in xsymbols.keys():
|
||||
sys.stderr.write(symbol+"\n")
|
106
development/tools/x-font
Normal file
106
development/tools/x-font
Normal file
@ -0,0 +1,106 @@
|
||||
forall 22
|
||||
sharp 23
|
||||
exists 24
|
||||
ni 27
|
||||
cong 40
|
||||
Delta 44
|
||||
Phi 46
|
||||
Gamma 47
|
||||
vartheta 4a
|
||||
Lambda 4c
|
||||
Pi 50
|
||||
Theta 51
|
||||
Sigma 53
|
||||
varsigma 56
|
||||
Omega 57
|
||||
Xi 58
|
||||
Psi 59
|
||||
therefore 5c
|
||||
bot 5e
|
||||
alpha 61
|
||||
beta 62
|
||||
chi 63
|
||||
delta 64
|
||||
varepsilon 65
|
||||
phi 66
|
||||
gamma 67
|
||||
eta 68
|
||||
iota 69
|
||||
varphi 6a
|
||||
kappa 6b
|
||||
lambda 6c
|
||||
mu 6d
|
||||
nu 6e
|
||||
pi 70
|
||||
theta 71
|
||||
rho 72
|
||||
sigma 73
|
||||
tau 74
|
||||
upsilon 75
|
||||
varpi 76
|
||||
omega 77
|
||||
xi 78
|
||||
psi 79
|
||||
zeta 7a
|
||||
mid 7c
|
||||
sim 7e
|
||||
Upsilon a1
|
||||
prime a2
|
||||
leq a3
|
||||
infty a5
|
||||
clubsuit a7
|
||||
diamondsuit a8
|
||||
heartsuit a9
|
||||
spadesuit aa
|
||||
leftrightarrow ab
|
||||
leftarrow ac
|
||||
uparrow ad
|
||||
rightarrow ae
|
||||
downarrow af
|
||||
textdegree b0
|
||||
pm b1
|
||||
geq b3
|
||||
times b4
|
||||
propto b5
|
||||
partial b6
|
||||
bullet b7
|
||||
div b8
|
||||
neq b9
|
||||
equiv ba
|
||||
approx bb
|
||||
aleph c0
|
||||
Im c1
|
||||
Re c2
|
||||
wp c3
|
||||
otimes c4
|
||||
oplus c5
|
||||
oslash c6
|
||||
cap c7
|
||||
cup c8
|
||||
supset c9
|
||||
supseteq ca
|
||||
subset cc
|
||||
subseteq cd
|
||||
in ce
|
||||
angle d0
|
||||
nabla d1
|
||||
prod d5
|
||||
surd d6
|
||||
cdot d7
|
||||
neg d8
|
||||
wedge d9
|
||||
vee da
|
||||
Leftrightarrow db
|
||||
Leftarrow dc
|
||||
Uparrow dd
|
||||
Rightarrow de
|
||||
Downarrow df
|
||||
diamond e0
|
||||
langle e1
|
||||
sum e5
|
||||
lceil e9
|
||||
lfloor eb
|
||||
rangle f1
|
||||
int f2
|
||||
rceil f9
|
||||
rfloor fb
|
@ -1,3 +1,12 @@
|
||||
2001-08-31 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* FontLoader.C (getFontinfo): Handle latex symbol fonts.
|
||||
(available): New method.
|
||||
|
||||
* FontInfo.C (getFontname): Use scalable fonts even when
|
||||
lyxrc.use_scalable_fonts is false, if no non-scalable fonts was
|
||||
found.
|
||||
|
||||
2001-08-23 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* converter.C (Formats::view): reverted! Incorrect fix.
|
||||
|
@ -50,7 +50,7 @@ string const FontInfo::getFontname(int size)
|
||||
}
|
||||
}
|
||||
|
||||
if (scalable && lyxrc.use_scalable_fonts) {
|
||||
if (scalable && (lyxrc.use_scalable_fonts || closestind == -1)) {
|
||||
// We can use scalable
|
||||
string const font = resize(strings[scaleindex], size);
|
||||
lyxerr[Debug::FONT] << "Using scalable font to get\n"
|
||||
@ -60,7 +60,7 @@ string const FontInfo::getFontname(int size)
|
||||
|
||||
// Did any fonts get close?
|
||||
if (closestind == -1) {
|
||||
// No, and we are not allowed to use scalables, so...
|
||||
// No, so...
|
||||
return string();
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ void FontLoader::update()
|
||||
void FontLoader::reset()
|
||||
{
|
||||
// Clear font infos, font structs and font metrics
|
||||
for (int i1 = 0; i1 < 4; ++i1)
|
||||
for (int i1 = 0; i1 < 9; ++i1)
|
||||
for (int i2 = 0; i2 < 2; ++i2)
|
||||
for (int i3 = 0; i3 < 4; ++i3) {
|
||||
fontinfo[i1][i2][i3] = 0;
|
||||
@ -75,7 +75,7 @@ void FontLoader::reset()
|
||||
void FontLoader::unload()
|
||||
{
|
||||
// Unload all fonts
|
||||
for (int i1 = 0; i1 < 4; ++i1)
|
||||
for (int i1 = 0; i1 < 9; ++i1)
|
||||
for (int i2 = 0; i2 < 2; ++i2)
|
||||
for (int i3 = 0; i3 < 4; ++i3) {
|
||||
if (fontinfo[i1][i2][i3]) {
|
||||
@ -103,12 +103,44 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
|
||||
if (fontinfo[family][series][shape] != 0)
|
||||
return;
|
||||
|
||||
// Special code for the symbol family
|
||||
if (family == LyXFont::SYMBOL_FAMILY){
|
||||
fontinfo[family][series][shape] = new FontInfo("-*-symbol-*");
|
||||
// Special fonts
|
||||
switch (family)
|
||||
{
|
||||
case LyXFont::SYMBOL_FAMILY:
|
||||
fontinfo[family][series][shape] =
|
||||
new FontInfo("-*-symbol-*-*-*-*-*-*-*-*-*-*-*-*");
|
||||
return;
|
||||
|
||||
case LyXFont::CMSY_FAMILY:
|
||||
fontinfo[family][series][shape] =
|
||||
new FontInfo("-*-cmsy-*-*-*-*-*-*-*-*-*-*-*-*");
|
||||
return;
|
||||
|
||||
case LyXFont::CMM_FAMILY:
|
||||
fontinfo[family][series][shape] =
|
||||
new FontInfo("-*-cmmi-medium-*-*-*-*-*-*-*-*-*-*-*");
|
||||
return;
|
||||
|
||||
case LyXFont::CMEX_FAMILY:
|
||||
fontinfo[family][series][shape] =
|
||||
new FontInfo("-*-cmex-*-*-*-*-*-*-*-*-*-*-*-*");
|
||||
return;
|
||||
|
||||
case LyXFont::MSA_FAMILY:
|
||||
fontinfo[family][series][shape] =
|
||||
new FontInfo("-*-msam-*-*-*-*-*-*-*-*-*-*-*-*");
|
||||
return;
|
||||
|
||||
case LyXFont::MSB_FAMILY:
|
||||
fontinfo[family][series][shape] =
|
||||
new FontInfo("-*-msbm-*-*-*-*-*-*-*-*-*-*-*-*");
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Normal font. Let's search for an existing name that matches.
|
||||
string ffamily;
|
||||
string fseries;
|
||||
@ -282,3 +314,11 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
|
||||
fontstruct[family][series][shape][size] = fs;
|
||||
return fs;
|
||||
}
|
||||
|
||||
|
||||
bool FontLoader::available(LyXFont const & f)
|
||||
{
|
||||
load(f.family(), f.series(), f.realShape(), f.size());
|
||||
return fontinfo[f.family()][f.series()][f.realShape()]
|
||||
->getFontname(f.size()).size();
|
||||
}
|
||||
|
@ -48,12 +48,15 @@ public:
|
||||
else
|
||||
return doLoad(family, series, shape, size);
|
||||
};
|
||||
/// Do we have anything matching?
|
||||
bool available(LyXFont const & f);
|
||||
|
||||
private:
|
||||
/// Array of font structs
|
||||
XFontStruct * fontstruct[4][2][4][10];
|
||||
XFontStruct * fontstruct[9][2][4][10];
|
||||
|
||||
/// Array of font infos
|
||||
FontInfo * fontinfo[4][2][4];
|
||||
FontInfo * fontinfo[9][2][4];
|
||||
|
||||
/// Reset font handler
|
||||
void reset();
|
||||
|
@ -284,7 +284,7 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls,
|
||||
XChar2b * xs = new XChar2b[ls];
|
||||
Encoding const * encoding = f.language()->encoding();
|
||||
LyXFont font(f);
|
||||
if (f.family() == LyXFont::SYMBOL_FAMILY) {
|
||||
if (f.isSymbolFont()) {
|
||||
#ifdef USE_UNICODE_FOR_SYMBOLS
|
||||
font.setFamily(LyXFont::ROMAN_FAMILY);
|
||||
font.setShape(LyXFont::UP_SHAPE);
|
||||
|
@ -114,7 +114,7 @@ int lyxfont::width(char const * s, size_t n, LyXFont const & f)
|
||||
Encoding const * encoding = f.language()->encoding();
|
||||
//LyXFont const * font = &f;
|
||||
LyXFont font(f);
|
||||
if (f.family() == LyXFont::SYMBOL_FAMILY) {
|
||||
if (f.isSymbolFont()) {
|
||||
#ifdef USE_UNICODE_FOR_SYMBOLS
|
||||
//LyXFont font2 = f;
|
||||
font.setFamily(LyXFont::ROMAN_FAMILY);
|
||||
|
@ -33,16 +33,16 @@ using std::endl;
|
||||
using std::strlen;
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// Names for the GUI
|
||||
//
|
||||
|
||||
namespace {
|
||||
|
||||
char const * GUIFamilyNames[6] =
|
||||
{ N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"), N_("Inherit"),
|
||||
N_("Ignore") };
|
||||
char const * GUIFamilyNames[11] =
|
||||
{ N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"),
|
||||
"cmsy", "cmm", "cmex", "msa", "msb",
|
||||
N_("Inherit"), N_("Ignore") };
|
||||
|
||||
char const * GUISeriesNames[4] =
|
||||
{ N_("Medium"), N_("Bold"), N_("Inherit"), N_("Ignore") };
|
||||
@ -63,8 +63,9 @@ char const * GUIMiscNames[5] =
|
||||
//
|
||||
// Strings used to read and write .lyx format files
|
||||
//
|
||||
char const * LyXFamilyNames[6] =
|
||||
{ "roman", "sans", "typewriter", "symbol", "default", "error" };
|
||||
char const * LyXFamilyNames[12] =
|
||||
{ "roman", "sans", "typewriter", "symbol", "symbol2", "symbol3",
|
||||
"symbolex", "fraktur", "mathscr", "mathbb", "default", "error" };
|
||||
|
||||
char const * LyXSeriesNames[4] =
|
||||
{ "medium", "bold", "default", "error" };
|
||||
|
@ -45,6 +45,16 @@ public:
|
||||
///
|
||||
SYMBOL_FAMILY,
|
||||
///
|
||||
CMSY_FAMILY,
|
||||
///
|
||||
CMM_FAMILY,
|
||||
///
|
||||
CMEX_FAMILY,
|
||||
///
|
||||
MSA_FAMILY,
|
||||
///
|
||||
MSB_FAMILY,
|
||||
///
|
||||
INHERIT_FAMILY,
|
||||
///
|
||||
IGNORE_FAMILY
|
||||
@ -201,6 +211,9 @@ public:
|
||||
///
|
||||
bool isVisibleRightToLeft() const;
|
||||
|
||||
///
|
||||
bool isSymbolFont() const;
|
||||
|
||||
///
|
||||
LyXFont & setFamily(LyXFont::FONT_FAMILY f);
|
||||
///
|
||||
@ -403,6 +416,23 @@ LyXFont::FONT_MISC_STATE LyXFont::noun() const
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool LyXFont::isSymbolFont() const
|
||||
{
|
||||
switch(family()) {
|
||||
case LyXFont::SYMBOL_FAMILY:
|
||||
case LyXFont::CMSY_FAMILY:
|
||||
case LyXFont::CMM_FAMILY:
|
||||
case LyXFont::CMEX_FAMILY:
|
||||
case LyXFont::MSA_FAMILY:
|
||||
case LyXFont::MSB_FAMILY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE);
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2001-08-31 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* math_hash.C: Read symbols information from external file
|
||||
many files: Add support for latex symbol fonts
|
||||
|
||||
2001-08-18 Dekel Tsur <dekelts@tau.ac.il>
|
||||
|
||||
* math_parser.C (Parser): Eat spaces after \end_inset
|
||||
|
@ -13,6 +13,21 @@
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
char const * math_font_name[] = {
|
||||
"mathrm",
|
||||
"mathcal",
|
||||
"mathbf",
|
||||
"mathsf",
|
||||
"mathtt",
|
||||
"mathit",
|
||||
"textrm"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
MathCharInset::MathCharInset(char c)
|
||||
: char_(c), code_(nativeCode(c))
|
||||
{
|
||||
|
@ -76,10 +76,9 @@ void MathDecorationInset::draw(Painter & pain, int x, int y) const
|
||||
|
||||
void MathDecorationInset::write(ostream & os, bool fragile) const
|
||||
{
|
||||
string name = key_->name;
|
||||
if (fragile && protect())
|
||||
os << "\\protect";
|
||||
os << '\\' << name;
|
||||
os << '\\' << key_->name;
|
||||
|
||||
if (key_->id == LM_not)
|
||||
os << ' ';
|
||||
|
@ -81,9 +81,19 @@ enum MathTextCodes {
|
||||
LM_TC_GREEK1,
|
||||
/// Internal code for symbols
|
||||
LM_TC_SYMB,
|
||||
/// Internal code for symbols that get bigger in displayed math
|
||||
/// internal code for symbols that get bigger in displayed math
|
||||
LM_TC_BSYM,
|
||||
///
|
||||
LM_TC_CMSY,
|
||||
///
|
||||
LM_TC_CMM,
|
||||
///
|
||||
LM_TC_CMEX,
|
||||
///
|
||||
LM_TC_MSA,
|
||||
///
|
||||
LM_TC_MSB,
|
||||
///
|
||||
LM_FONT_END,
|
||||
|
||||
/// This must be < 32
|
||||
@ -124,7 +134,7 @@ enum MathInsetTypes {
|
||||
|
||||
|
||||
///
|
||||
enum MathBinaryTypes {
|
||||
enum MathSymbolTypes {
|
||||
///
|
||||
LMB_NONE = 0,
|
||||
///
|
||||
|
@ -34,6 +34,11 @@ MathInset * createMathInset(latexkeys const * l)
|
||||
case LM_TK_SPECIAL:
|
||||
return new MathSpecialCharInset(l->id);
|
||||
case LM_TK_SYM:
|
||||
case LM_TK_CMSY:
|
||||
case LM_TK_CMM:
|
||||
case LM_TK_CMEX:
|
||||
case LM_TK_MSA:
|
||||
case LM_TK_MSB:
|
||||
return new MathSymbolInset(l);
|
||||
case LM_TK_STACK:
|
||||
return new MathStackrelInset;
|
||||
|
@ -1,6 +1,12 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "math_parser.h"
|
||||
#include "lyxlex.h"
|
||||
#include "debug.h"
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
#include "support/lyxfunctional.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
@ -13,10 +19,19 @@ namespace {
|
||||
|
||||
// This lists needs to remain sorted all the time!
|
||||
|
||||
latexkeys wordlist[] =
|
||||
struct latexkeys_a {
|
||||
///
|
||||
char const * name;
|
||||
///
|
||||
short token;
|
||||
///
|
||||
unsigned int id;
|
||||
///
|
||||
MathSymbolTypes type;
|
||||
};
|
||||
|
||||
latexkeys_a wordlist_array[] =
|
||||
{
|
||||
//{"oint", LM_TK_BIGSYM, LM_oint, LMB_NONE},
|
||||
//{"pmod", LM_TK_SYM, 0, LMB_NONE},
|
||||
{"!", LM_TK_SPACE, 0, LMB_NONE},
|
||||
{"#", LM_TK_SPECIAL, '#', LMB_NONE},
|
||||
{"$", LM_TK_SPECIAL, '$', LMB_NONE},
|
||||
@ -28,144 +43,52 @@ latexkeys wordlist[] =
|
||||
{".", LM_TK_SPECIAL, '.', LMB_NONE},
|
||||
{":", LM_TK_SPACE, 2, LMB_NONE},
|
||||
{";", LM_TK_SPACE, 3, LMB_NONE},
|
||||
{"Delta", LM_TK_SYM, LM_Delta, LMB_NONE},
|
||||
{"Downarrow", LM_TK_SYM, LM_Downarrow, LMB_NONE},
|
||||
{"Gamma", LM_TK_SYM, LM_Gamma, LMB_NONE},
|
||||
{"Im", LM_TK_SYM, LM_Im, LMB_NONE},
|
||||
{"Lambda", LM_TK_SYM, LM_Lambda, LMB_NONE},
|
||||
{"Leftarrow", LM_TK_SYM, LM_Leftarrow, LMB_NONE},
|
||||
{"Leftrightarrow", LM_TK_SYM, LM_Leftrightarrow, LMB_NONE},
|
||||
{"Longleftarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"Longleftrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"Longrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"Omega", LM_TK_SYM, LM_Omega, LMB_NONE},
|
||||
{"Phi", LM_TK_SYM, LM_Phi, LMB_NONE},
|
||||
{"Pi", LM_TK_SYM, LM_Pi, LMB_NONE},
|
||||
{"Pr", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"Psi", LM_TK_SYM, LM_Psi, LMB_NONE},
|
||||
{"Re", LM_TK_SYM, LM_Re, LMB_NONE},
|
||||
{"Rightarrow", LM_TK_SYM, LM_Rightarrow, LMB_NONE},
|
||||
{"Sigma", LM_TK_SYM, LM_Sigma, LMB_NONE},
|
||||
{"Theta", LM_TK_SYM, LM_Theta, LMB_NONE},
|
||||
{"Uparrow", LM_TK_SYM, LM_Uparrow, LMB_NONE},
|
||||
{"Updownarrow", LM_TK_NOGLYPH, LM_Updownarrow, LMB_NONE},
|
||||
{"Upsilon", LM_TK_SYM, LM_Upsilon, LMB_NONE},
|
||||
{"Vert", LM_TK_NOGLYPH, LM_Vert, LMB_NONE},
|
||||
{"Xi", LM_TK_SYM, LM_Xi, LMB_NONE},
|
||||
{"[", LM_TK_BEGIN, LM_OT_EQUATION, LMB_NONE},
|
||||
{"\\", LM_TK_NEWLINE, static_cast<unsigned>(-1), LMB_NONE}, // -1 needed in mathed_parse_lines!
|
||||
{"]", LM_TK_END, LM_OT_EQUATION, LMB_NONE},
|
||||
{"_", LM_TK_SPECIAL, '_', LMB_NONE},
|
||||
{"acute", LM_TK_DECORATION, LM_acute, LMB_NONE},
|
||||
{"aleph", LM_TK_SYM, LM_aleph, LMB_NONE},
|
||||
{"alpha", LM_TK_SYM, LM_alpha, LMB_NONE},
|
||||
{"amalg", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"angle", LM_TK_SYM, LM_angle, LMB_NONE},
|
||||
{"approx", LM_TK_SYM, LM_approx, LMB_RELATION},
|
||||
{"arccos", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"arcsin", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"arctan", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"arg", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"asymp", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"atop", LM_TK_ATOP, 0, LMB_NONE},
|
||||
{"backslash", LM_TK_SPECIAL, '\\', LMB_NONE},
|
||||
{"bar", LM_TK_DECORATION, LM_bar, LMB_NONE},
|
||||
{"begin", LM_TK_BEGIN, 0, LMB_NONE},
|
||||
{"beta", LM_TK_SYM, LM_beta, LMB_NONE},
|
||||
{"bigcap", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigcirc", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"bigcup", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigodot", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigoplus", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigotimes", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigsqcup", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigtriangledown", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"bigtriangleup", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"biguplus", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigvee", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"bigwedge", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"binom", LM_TK_BINOM, 0, LMB_NONE},
|
||||
{"bmod", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"bot", LM_TK_SYM, LM_bot, LMB_NONE},
|
||||
{"bowtie", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"breve", LM_TK_DECORATION, LM_breve, LMB_NONE},
|
||||
{"bullet", LM_TK_SYM, LM_bullet, LMB_OPERATOR},
|
||||
{"cal", LM_TK_OLDFONT, LM_TC_CAL, LMB_OPERATOR},
|
||||
{"cap", LM_TK_SYM, LM_cap, LMB_OPERATOR},
|
||||
{"cdot", LM_TK_SYM, LM_cdot, LMB_OPERATOR},
|
||||
{"cdots", LM_TK_DOTS, LM_cdots, LMB_NONE},
|
||||
{"check", LM_TK_DECORATION, LM_check, LMB_NONE},
|
||||
{"chi", LM_TK_SYM, LM_chi, LMB_NONE},
|
||||
{"choose", LM_TK_CHOOSE, 0, LMB_NONE},
|
||||
{"circ", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"clubsuit", LM_TK_SYM, LM_clubsuit, LMB_NONE},
|
||||
{"cong", LM_TK_SYM, LM_cong, LMB_RELATION},
|
||||
{"coprod", LM_TK_NOGLYPHB, 0, LMB_NONE},
|
||||
{"cos", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"cosh", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"cot", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"coth", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"csc", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"cup", LM_TK_SYM, LM_cup, LMB_OPERATOR},
|
||||
{"dagger", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"dashv", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"ddagger", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"ddot", LM_TK_DECORATION, LM_ddot, LMB_NONE},
|
||||
{"ddots", LM_TK_DOTS, LM_ddots, LMB_NONE},
|
||||
{"deg", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"delta", LM_TK_SYM, LM_delta, LMB_NONE},
|
||||
{"det", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"diamond", LM_TK_SYM, LM_diamond, LMB_OPERATOR},
|
||||
{"diamondsuit", LM_TK_SYM, LM_diamondsuit, LMB_NONE},
|
||||
{"dim", LM_TK_FUNC, 0, LMB_NONE},
|
||||
//{"displaystyle", LM_TK_STY, LM_ST_DISPLAY, LMB_NONE},
|
||||
{"div", LM_TK_SYM, LM_div, LMB_OPERATOR},
|
||||
{"dot", LM_TK_DECORATION, LM_dot, LMB_NONE},
|
||||
{"doteq", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"downarrow", LM_TK_SYM, LM_downarrow, LMB_NONE},
|
||||
{"ell", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"end", LM_TK_END, 0, LMB_NONE},
|
||||
{"epsilon", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"equiv", LM_TK_SYM, LM_equiv, LMB_RELATION},
|
||||
{"eta", LM_TK_SYM, LM_eta, LMB_NONE},
|
||||
{"exists", LM_TK_SYM, LM_exists, LMB_NONE},
|
||||
{"exp", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"flat", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"forall", LM_TK_SYM, LM_forall, LMB_NONE},
|
||||
{"frac", LM_TK_FRAC, 0, LMB_NONE},
|
||||
{"frown", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"gamma", LM_TK_SYM, LM_gamma, LMB_NONE},
|
||||
{"gcd", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"geq", LM_TK_SYM, LM_geq, LMB_RELATION},
|
||||
{"grave", LM_TK_DECORATION, LM_grave, LMB_NONE},
|
||||
{"hat", LM_TK_DECORATION, LM_hat, LMB_NONE},
|
||||
{"hbar", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"heartsuit", LM_TK_SYM, LM_heartsuit, LMB_NONE},
|
||||
{"hom", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"hookleftarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"hookrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"imath", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"in", LM_TK_SYM, LM_in, LMB_RELATION},
|
||||
{"inf", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"infty", LM_TK_SYM, LM_infty, LMB_NONE},
|
||||
{"int", LM_TK_BIGSYM, LM_int, LMB_NONE},
|
||||
{"iota", LM_TK_SYM, LM_iota, LMB_NONE},
|
||||
{"jmath", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"kappa", LM_TK_SYM, LM_kappa, LMB_NONE},
|
||||
{"ker", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"kern", LM_TK_KERN, 0, LMB_NONE},
|
||||
{"label", LM_TK_LABEL, 0, LMB_NONE},
|
||||
{"lambda", LM_TK_SYM, LM_lambda, LMB_NONE},
|
||||
{"langle", LM_TK_SYM, LM_langle, LMB_NONE},
|
||||
{"lceil", LM_TK_SYM, LM_lceil, LMB_NONE},
|
||||
{"ldots", LM_TK_DOTS, LM_ldots, LMB_NONE},
|
||||
{"left", LM_TK_LEFT, 0, LMB_NONE},
|
||||
{"leftarrow", LM_TK_SYM, LM_leftarrow, LMB_NONE},
|
||||
{"leftharpoondown", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"leftharpoonup", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"leftrightarrow", LM_TK_SYM, LM_leftrightarrow, LMB_NONE},
|
||||
{"leq", LM_TK_SYM, LM_leq, LMB_RELATION},
|
||||
{"lfloor", LM_TK_SYM, LM_lfloor, LMB_NONE},
|
||||
{"lg", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"lim", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"liminf", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
@ -173,11 +96,6 @@ latexkeys wordlist[] =
|
||||
{"limsup", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"ln", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"log", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"longleftarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"longleftrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"longmapsto", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"longrightarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"mapsto", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"mathbf", LM_TK_FONT, LM_TC_BF, LMB_NONE},
|
||||
{"mathcal", LM_TK_FONT, LM_TC_CAL, LMB_NONE},
|
||||
{"mathit", LM_TK_FONT, LM_TC_IT, LMB_NONE},
|
||||
@ -186,153 +104,128 @@ latexkeys wordlist[] =
|
||||
{"mathsf", LM_TK_FONT, LM_TC_SF, LMB_NONE},
|
||||
{"mathtt", LM_TK_FONT, LM_TC_TT, LMB_NONE},
|
||||
{"max", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"mid", LM_TK_SYM, LM_mid, LMB_RELATION},
|
||||
{"min", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"models", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"mp", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"mu", LM_TK_SYM, LM_mu, LMB_NONE},
|
||||
{"nabla", LM_TK_SYM, LM_nabla, LMB_NONE},
|
||||
{"natural", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"nearrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"neg", LM_TK_SYM, LM_neg, LMB_NONE},
|
||||
{"neq", LM_TK_SYM, LM_neq, LMB_RELATION},
|
||||
{"newcommand", LM_TK_NEWCOMMAND, 0 , LMB_NONE},
|
||||
{"ni", LM_TK_SYM, LM_ni, LMB_RELATION},
|
||||
{"nolimits", LM_TK_LIMIT, static_cast<unsigned>(-1), LMB_NONE},
|
||||
{"nonumber", LM_TK_NONUM, 0, LMB_NONE},
|
||||
{"not", LM_TK_NOT, LM_not, LMB_NONE},
|
||||
{"nu", LM_TK_SYM, LM_nu, LMB_NONE},
|
||||
{"nwarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"odot", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"omega", LM_TK_SYM, LM_omega, LMB_NONE},
|
||||
{"ominus", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"oplus", LM_TK_SYM, LM_oplus, LMB_OPERATOR},
|
||||
{"oslash", LM_TK_SYM, LM_oslash, LMB_OPERATOR},
|
||||
{"otimes", LM_TK_SYM, LM_otimes, LMB_OPERATOR},
|
||||
{"over", LM_TK_OVER, 0, LMB_NONE},
|
||||
{"overbrace", LM_TK_DECORATION, LM_overbrace, LMB_NONE},
|
||||
{"overleftarrow", LM_TK_DECORATION, LM_overleftarrow, LMB_NONE},
|
||||
{"overline", LM_TK_DECORATION, LM_overline, LMB_NONE},
|
||||
{"overrightarrow", LM_TK_DECORATION, LM_overightarrow, LMB_NONE},
|
||||
{"parallel", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"partial", LM_TK_SYM, LM_partial, LMB_NONE},
|
||||
{"phi", LM_TK_SYM, LM_phi, LMB_NONE},
|
||||
{"pi", LM_TK_SYM, LM_pi, LMB_NONE},
|
||||
{"pm", LM_TK_SYM, LM_pm, LMB_OPERATOR},
|
||||
{"prec", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"preceq", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"prime", LM_TK_SYM, LM_prime, LMB_NONE},
|
||||
{"prod", LM_TK_BIGSYM, LM_prod, LMB_NONE},
|
||||
{"propto", LM_TK_SYM, LM_propto, LMB_RELATION},
|
||||
{"protect", LM_TK_PROTECT, 0, LMB_RELATION},
|
||||
{"psi", LM_TK_SYM, LM_psi, LMB_NONE},
|
||||
{"qquad", LM_TK_SPACE, 5, LMB_NONE},
|
||||
{"quad", LM_TK_SPACE, 4, LMB_NONE},
|
||||
{"rangle", LM_TK_SYM, LM_rangle, LMB_NONE},
|
||||
{"rceil", LM_TK_SYM, LM_rceil, LMB_NONE},
|
||||
{"rfloor", LM_TK_SYM, LM_rfloor, LMB_NONE},
|
||||
{"rho", LM_TK_SYM, LM_rho, LMB_NONE},
|
||||
{"right", LM_TK_RIGHT, 0, LMB_NONE},
|
||||
{"rightarrow", LM_TK_SYM, LM_rightarrow, LMB_NONE},
|
||||
{"rightharpoondown", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"rightharpoonup", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"rightleftharpoons", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"root", LM_TK_ROOT, 0, LMB_NONE},
|
||||
//{"scriptscriptstyle", LM_TK_STY, LM_ST_SCRIPTSCRIPT, LMB_NONE},
|
||||
//{"scriptstyle", LM_TK_STY, LM_ST_SCRIPT, LMB_NONE},
|
||||
{"searrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"sec", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"setminus", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"sharp", LM_TK_SYM, LM_sharp, LMB_NONE},
|
||||
{"sigma", LM_TK_SYM, LM_sigma, LMB_NONE},
|
||||
{"sim", LM_TK_SYM, LM_sim, LMB_RELATION},
|
||||
{"simeq", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"sin", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"sinh", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"smile", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"spadesuit", LM_TK_SYM, LM_spadesuit, LMB_NONE},
|
||||
{"sqcap", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"sqcup", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"sqrt", LM_TK_SQRT, 0, LMB_NONE},
|
||||
{"sqsubseteq", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"sqsupseteq", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"stackrel", LM_TK_STACK, 0, LMB_NONE},
|
||||
{"star", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"subset", LM_TK_SYM, LM_subset, LMB_RELATION},
|
||||
{"subseteq", LM_TK_SYM, LM_subseteq, LMB_RELATION},
|
||||
{"succ", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"succeq", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"sum", LM_TK_BIGSYM, LM_sum, LMB_NONE},
|
||||
{"sup", LM_TK_FUNCLIM, 0, LMB_NONE},
|
||||
{"supset", LM_TK_SYM, LM_supset, LMB_RELATION},
|
||||
{"supseteq", LM_TK_SYM, LM_supseteq, LMB_RELATION},
|
||||
{"surd", LM_TK_SYM, LM_surd, LMB_NONE},
|
||||
{"swarrow", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"tan", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"tanh", LM_TK_FUNC, 0, LMB_NONE},
|
||||
{"tau", LM_TK_SYM, LM_tau, LMB_NONE},
|
||||
{"textrm", LM_TK_FONT, LM_TC_TEXTRM, LMB_NONE},
|
||||
{"textdegree", LM_TK_SYM, LM_textdegree, LMB_NONE},
|
||||
//{"textstyle", LM_TK_STY, LM_ST_TEXT, LMB_NONE},
|
||||
{"therefore", LM_TK_SYM, LM_therefore, LMB_NONE},
|
||||
{"theta", LM_TK_SYM, LM_theta, LMB_NONE},
|
||||
{"tilde", LM_TK_DECORATION, LM_tilde, LMB_NONE},
|
||||
{"times", LM_TK_SYM, LM_times, LMB_OPERATOR},
|
||||
{"top", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"triangle", LM_TK_NOGLYPH, 0, LMB_NONE},
|
||||
{"triangleleft", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"triangleright", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"underbrace", LM_TK_DECORATION, LM_underbrace, LMB_NONE},
|
||||
{"underline", LM_TK_DECORATION, LM_underline, LMB_NONE},
|
||||
{"uparrow", LM_TK_SYM, LM_uparrow, LMB_NONE},
|
||||
{"updownarrow", LM_TK_NOGLYPH, LM_updownarrow, LMB_NONE},
|
||||
{"uplus", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"upsilon", LM_TK_SYM, LM_upsilon, LMB_NONE},
|
||||
{"varepsilon", LM_TK_SYM, LM_varepsilon, LMB_NONE},
|
||||
{"varphi", LM_TK_SYM, LM_varphi, LMB_NONE},
|
||||
{"varpi", LM_TK_SYM, LM_varpi, LMB_NONE},
|
||||
{"varsigma", LM_TK_SYM, LM_varsigma, LMB_NONE},
|
||||
{"vartheta", LM_TK_SYM, LM_vartheta, LMB_NONE},
|
||||
{"vdash", LM_TK_NOGLYPH, 0, LMB_RELATION},
|
||||
{"vdots", LM_TK_DOTS, LM_vdots, LMB_NONE},
|
||||
{"vec", LM_TK_DECORATION, LM_vec, LMB_NONE},
|
||||
{"vee", LM_TK_SYM, LM_vee, LMB_OPERATOR},
|
||||
{"wedge", LM_TK_SYM, LM_wedge, LMB_OPERATOR},
|
||||
{"widehat", LM_TK_DECORATION, LM_widehat, LMB_NONE},
|
||||
{"widetilde", LM_TK_DECORATION, LM_widetilde, LMB_NONE},
|
||||
{"wp", LM_TK_SYM, LM_wp, LMB_NONE},
|
||||
{"wr", LM_TK_NOGLYPH, 0, LMB_OPERATOR},
|
||||
{"xi", LM_TK_SYM, LM_xi, LMB_NONE},
|
||||
{"zeta", LM_TK_SYM, LM_zeta, LMB_NONE},
|
||||
{"{", LM_TK_SPECIAL, '{', LMB_NONE},
|
||||
{"|", LM_TK_UNDEF, '|', LMB_NONE},
|
||||
{"}", LM_TK_SPECIAL, '}', LMB_NONE}
|
||||
{"}", LM_TK_SPECIAL, '}', LMB_NONE},
|
||||
{"", LM_TK_SPECIAL, 0, LMB_NONE}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// the "Initializer": Its default constructor is executed on loading and
|
||||
// sorts the list. Not exactly needed as long as the list is kept sorted
|
||||
// but who knows...
|
||||
std::vector<latexkeys> wordlist;
|
||||
|
||||
struct init {
|
||||
init() {
|
||||
std::sort(wordlist, wordlist + sizeof(wordlist)/sizeof(wordlist[0]));
|
||||
}
|
||||
};
|
||||
|
||||
static init dummy;
|
||||
bool initialized = false;
|
||||
|
||||
} // namespace anon
|
||||
|
||||
void ReadSymbols(string const & filename)
|
||||
{
|
||||
for(latexkeys_a * p = wordlist_array; !string(p->name).empty(); ++p) {
|
||||
latexkeys tmp;
|
||||
tmp.name = p->name;
|
||||
tmp.token = p->token;
|
||||
tmp.id = p->id;
|
||||
tmp.latex_font_id = 0;
|
||||
tmp.type = p->type;
|
||||
wordlist.push_back(tmp);
|
||||
}
|
||||
|
||||
LyXLex lex(0, 0);
|
||||
lex.setFile(filename);
|
||||
while (lex.isOK()) {
|
||||
latexkeys tmp;
|
||||
string font;
|
||||
string type;
|
||||
|
||||
if (lex.next())
|
||||
tmp.name = lex.getString();
|
||||
else
|
||||
break;
|
||||
|
||||
if (lex.next())
|
||||
font = lex.getString();
|
||||
if (lex.next())
|
||||
tmp.latex_font_id = lex.getInteger();
|
||||
if (lex.next())
|
||||
tmp.id = lex.getInteger();
|
||||
if (lex.next())
|
||||
type = lex.getString();
|
||||
|
||||
if (font == "cmsy")
|
||||
tmp.token = LM_TK_CMSY;
|
||||
else if (font == "cmm")
|
||||
tmp.token = LM_TK_CMM;
|
||||
else if (font == "cmex")
|
||||
tmp.token = LM_TK_CMEX;
|
||||
else if (font == "msa")
|
||||
tmp.token = LM_TK_MSA;
|
||||
else if (font == "msb")
|
||||
tmp.token = LM_TK_MSB;
|
||||
else
|
||||
tmp.token = LM_TK_SYM;
|
||||
|
||||
if (type == "mathrel")
|
||||
tmp.type = LMB_RELATION;
|
||||
else if (type == "mathbin")
|
||||
tmp.type = LMB_OPERATOR;
|
||||
else
|
||||
tmp.type = LMB_NONE;
|
||||
|
||||
wordlist.push_back(tmp);
|
||||
}
|
||||
|
||||
std::sort(wordlist.begin(), wordlist.end());
|
||||
}
|
||||
|
||||
|
||||
latexkeys const * in_word_set(string const & str)
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Not nice yet...
|
||||
#endif
|
||||
latexkeys tmp;
|
||||
tmp.name = str.c_str();
|
||||
int const n = sizeof(wordlist)/sizeof(wordlist[0]);
|
||||
latexkeys const * pos = std::lower_bound(wordlist, wordlist + n, tmp);
|
||||
return (string(pos->name) == str) ? pos : 0;
|
||||
if (!initialized) {
|
||||
lyxerr[Debug::MATHED] << "Reading symbols file" << endl;
|
||||
string const file = LibFileSearch(string(), "symbols");
|
||||
if (file.empty())
|
||||
lyxerr << "Could not find symbols file" << endl;
|
||||
else
|
||||
ReadSymbols(file);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
std::vector<latexkeys>::iterator it =
|
||||
std::find_if(wordlist.begin(), wordlist.end(),
|
||||
lyx::compare_memfun(&latexkeys::Name, str));
|
||||
return (it != wordlist.end()) ? &(*it) : 0;
|
||||
}
|
||||
|
@ -85,22 +85,43 @@ void MathMacroTable::builtinMacros()
|
||||
built = true;
|
||||
//lyxerr[Debug::MATHED] << "Building macros\n";
|
||||
|
||||
createTemplate("emptyset", 0, "\\not0");
|
||||
createTemplate("ne", 0, "\\not=");
|
||||
createTemplate("ge", 0, "\\geq");
|
||||
createTemplate("gets", 0, "\\leftarrow");
|
||||
createTemplate("land", 0, "\\wedge");
|
||||
createTemplate("le", 0, "\\leq");
|
||||
createTemplate("lor", 0, "\\vee");
|
||||
//createTemplate("emptyset", 0, "\\not0");
|
||||
createTemplate("notin", 0, "\\not\\in");
|
||||
createTemplate("perp", 0, "\\bot");
|
||||
|
||||
// fontmath.ltx
|
||||
|
||||
createTemplate("lnot", 0, "\\neg");
|
||||
createTemplate("land", 0, "\\wedge");
|
||||
createTemplate("lor", 0, "\\vee");
|
||||
createTemplate("ne", 0, "\\neq");
|
||||
createTemplate("le", 0, "\\leq");
|
||||
createTemplate("ge", 0, "\\geq");
|
||||
createTemplate("owns", 0, "\\ni");
|
||||
createTemplate("gets", 0, "\\leftarrow");
|
||||
createTemplate("to", 0, "\\rightarrow");
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning 9em looks like too much but it is somehow working on screen..
|
||||
#endif
|
||||
createTemplate("ll", 0, "<\\kern-9em<");
|
||||
createTemplate("gg", 0, ">\\kern-9em>");
|
||||
|
||||
//amsfonts.sty
|
||||
|
||||
createTemplate("dasharrow", 0, "\\dashrightarrow");
|
||||
createTemplate("Box", 0, "\\square");
|
||||
createTemplate("Diamond", 0, "\\lozenge");
|
||||
createTemplate("leadsto", 0, "\\rightsquigarrow");
|
||||
|
||||
// amssymb.sty
|
||||
|
||||
createTemplate("restriction", 0, "\\upharpoonright");
|
||||
createTemplate("Doteq", 0, "\\doteqdot");
|
||||
createTemplate("doublecup", 0, "\\Cup");
|
||||
createTemplate("doublecap", 0, "\\Cap");
|
||||
createTemplate("llless", 0, "\\lll");
|
||||
createTemplate("gggtr", 0, "\\ggg");
|
||||
|
||||
// #ifdef WITH_WARNINGS
|
||||
// #warning 9em looks like too much but it is somehow working on screen..
|
||||
// #endif WITH_WARNINGS
|
||||
// createTemplate("ll", 0, "<\\kern-9em<");
|
||||
// createTemplate("gg", 0, ">\\kern-9em>");
|
||||
|
||||
//createTemplate("lint", 4, "\\int_#1^#2#3 d#4");
|
||||
//createTemplate("silentmult", 0, "\\cdot");
|
||||
//createTemplate("binom", 2, "\\left(\\frac#1#2\\right)");
|
||||
|
@ -81,6 +81,16 @@ enum MathTokenEnum
|
||||
///
|
||||
LM_TK_NOGLYPHB,
|
||||
///
|
||||
LM_TK_CMSY,
|
||||
///
|
||||
LM_TK_CMM,
|
||||
///
|
||||
LM_TK_CMEX,
|
||||
///
|
||||
LM_TK_MSA,
|
||||
///
|
||||
LM_TK_MSB,
|
||||
///
|
||||
LM_TK_LABEL,
|
||||
///
|
||||
LM_TK_NONUM,
|
||||
@ -114,19 +124,26 @@ enum MathTokenEnum
|
||||
///
|
||||
struct latexkeys {
|
||||
///
|
||||
char const * name;
|
||||
string name;
|
||||
///
|
||||
short token;
|
||||
///
|
||||
unsigned int id;
|
||||
///
|
||||
int numargs;
|
||||
unsigned char latex_font_id;
|
||||
///
|
||||
MathSymbolTypes type;
|
||||
///
|
||||
string const & Name() const { return name;}
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
latexkeys const * in_word_set(string const & str);
|
||||
|
||||
///
|
||||
void ReadSymbols(string const & file);
|
||||
|
||||
MathMatrixInset * mathed_parse_normal(string const &);
|
||||
MathMatrixInset * mathed_parse_normal(std::istream &);
|
||||
MathMatrixInset * mathed_parse_normal(LyXLex &);
|
||||
|
@ -7,8 +7,7 @@
|
||||
using std::ostream;
|
||||
|
||||
MathSymbolInset::MathSymbolInset(const latexkeys * l)
|
||||
: sym_(l)
|
||||
{}
|
||||
: sym_(l), h_(0) {}
|
||||
|
||||
|
||||
MathInset * MathSymbolInset::clone() const
|
||||
@ -29,10 +28,43 @@ void MathSymbolInset::writeNormal(ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
MathTextCodes MathSymbolInset::code() const
|
||||
{
|
||||
switch(sym_->token) {
|
||||
case LM_TK_CMSY:
|
||||
return LM_TC_CMSY;
|
||||
case LM_TK_CMM:
|
||||
return LM_TC_CMM;
|
||||
case LM_TK_CMEX:
|
||||
return LM_TC_CMEX;
|
||||
case LM_TK_MSA:
|
||||
return LM_TC_MSA;
|
||||
case LM_TK_MSB:
|
||||
return LM_TC_MSB;
|
||||
default:
|
||||
return LM_TC_SYMB;
|
||||
}
|
||||
}
|
||||
|
||||
void MathSymbolInset::metrics(MathStyles st) const
|
||||
{
|
||||
size(st);
|
||||
mathed_char_dim(LM_TC_SYMB, size_, sym_->id, ascent_, descent_, width_);
|
||||
size_ = st;
|
||||
MathTextCodes Code = code();
|
||||
if (sym_->latex_font_id > 0 && math_font_available(Code)) {
|
||||
mathed_char_dim(Code, size_, sym_->latex_font_id,
|
||||
ascent_, descent_, width_);
|
||||
if (Code == LM_TC_CMEX) {
|
||||
h_ = 4*descent_/5;
|
||||
ascent_ += h_;
|
||||
descent_ -= h_;
|
||||
}
|
||||
} else if (sym_->id > 0 && sym_->id < 255 &&
|
||||
math_font_available(LM_TC_SYMB)) {
|
||||
mathed_char_dim(LM_TC_SYMB, size_, sym_->id,
|
||||
ascent_, descent_, width_);
|
||||
} else {
|
||||
mathed_string_dim(LM_TC_TEX, size_, sym_->name, ascent_, descent_, width_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,12 +72,24 @@ void MathSymbolInset::draw(Painter & pain, int x, int y) const
|
||||
{
|
||||
xo(x);
|
||||
yo(y);
|
||||
|
||||
MathTextCodes Code = code();
|
||||
if (sym_->latex_font_id > 0 && math_font_available(Code))
|
||||
drawChar(pain, Code, size_, x, y - h_, sym_->latex_font_id);
|
||||
else if (sym_->id > 0 && sym_->id < 255 &&
|
||||
math_font_available(LM_TC_SYMB))
|
||||
drawChar(pain, LM_TC_SYMB, size_, x, y, sym_->id);
|
||||
else
|
||||
drawStr(pain, LM_TC_TEX, size_, x, y, sym_->name);
|
||||
}
|
||||
|
||||
|
||||
bool MathSymbolInset::isRelOp() const
|
||||
{
|
||||
return sym_->id == LM_leq || sym_->id == LM_geq;
|
||||
return sym_->type == LMB_RELATION;
|
||||
}
|
||||
|
||||
|
||||
bool MathSymbolInset::isScriptable() const
|
||||
{
|
||||
return sym_->token == LM_TK_CMEX;
|
||||
}
|
||||
|
@ -25,9 +25,16 @@ public:
|
||||
void draw(Painter &, int x, int y) const;
|
||||
///
|
||||
bool isRelOp() const;
|
||||
///
|
||||
bool isScriptable() const;
|
||||
|
||||
private:
|
||||
///
|
||||
MathTextCodes code() const;
|
||||
|
||||
///
|
||||
latexkeys const * sym_;
|
||||
///
|
||||
mutable int h_;
|
||||
};
|
||||
#endif
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "mathed/support.h"
|
||||
#include "lyxfont.h"
|
||||
#include "FontLoader.h"
|
||||
#include "font.h"
|
||||
#include "math_defs.h"
|
||||
#include "math_parser.h"
|
||||
@ -16,9 +17,9 @@ using std::endl;
|
||||
using std::max;
|
||||
|
||||
|
||||
bool isBinaryOp(char c)
|
||||
bool isBinaryOp(char c, MathTextCodes type)
|
||||
{
|
||||
return strchr("+-<>=/*", c);
|
||||
return type < LM_TC_SYMB && strchr("+-<>=/*", c);
|
||||
}
|
||||
|
||||
|
||||
@ -98,88 +99,109 @@ void Matrix::transform(float xp, float yp, float & x, float & y)
|
||||
|
||||
namespace {
|
||||
|
||||
LyXFont * Math_Fonts = 0;
|
||||
LyXFont * MathFonts = 0;
|
||||
bool font_available[LM_FONT_END];
|
||||
bool font_available_initialized[LM_FONT_END];
|
||||
|
||||
void mathed_init_fonts()
|
||||
{
|
||||
Math_Fonts = new LyXFont[8]; //DEC cxx cannot initialize all fonts
|
||||
MathFonts = new LyXFont[13]; //DEC cxx cannot initialize all fonts
|
||||
//at once (JMarc) rc
|
||||
|
||||
for (int i = 0 ; i < 8 ; ++i) {
|
||||
Math_Fonts[i] = LyXFont(LyXFont::ALL_SANE);
|
||||
for (int i = 0 ; i < 13 ; ++i) {
|
||||
MathFonts[i] = LyXFont(LyXFont::ALL_SANE);
|
||||
}
|
||||
|
||||
Math_Fonts[0].setShape(LyXFont::ITALIC_SHAPE);
|
||||
MathFonts[0].setShape(LyXFont::ITALIC_SHAPE);
|
||||
|
||||
Math_Fonts[1].setFamily(LyXFont::SYMBOL_FAMILY);
|
||||
MathFonts[1].setFamily(LyXFont::SYMBOL_FAMILY);
|
||||
|
||||
Math_Fonts[2].setFamily(LyXFont::SYMBOL_FAMILY);
|
||||
Math_Fonts[2].setShape(LyXFont::ITALIC_SHAPE);
|
||||
MathFonts[2].setFamily(LyXFont::SYMBOL_FAMILY);
|
||||
MathFonts[2].setShape(LyXFont::ITALIC_SHAPE);
|
||||
|
||||
Math_Fonts[3].setSeries(LyXFont::BOLD_SERIES);
|
||||
MathFonts[3].setSeries(LyXFont::BOLD_SERIES);
|
||||
|
||||
Math_Fonts[4].setFamily(LyXFont::SANS_FAMILY);
|
||||
Math_Fonts[4].setShape(LyXFont::ITALIC_SHAPE);
|
||||
MathFonts[4].setFamily(LyXFont::SANS_FAMILY);
|
||||
MathFonts[4].setShape(LyXFont::ITALIC_SHAPE);
|
||||
|
||||
Math_Fonts[5].setFamily(LyXFont::TYPEWRITER_FAMILY);
|
||||
MathFonts[5].setFamily(LyXFont::TYPEWRITER_FAMILY);
|
||||
|
||||
Math_Fonts[6].setFamily(LyXFont::ROMAN_FAMILY);
|
||||
MathFonts[6].setFamily(LyXFont::ROMAN_FAMILY);
|
||||
|
||||
Math_Fonts[7].setFamily(LyXFont::SANS_FAMILY);
|
||||
MathFonts[7].setFamily(LyXFont::SANS_FAMILY);
|
||||
|
||||
MathFonts[8].setFamily(LyXFont::CMSY_FAMILY);
|
||||
MathFonts[9].setFamily(LyXFont::CMM_FAMILY);
|
||||
MathFonts[10].setFamily(LyXFont::CMEX_FAMILY);
|
||||
MathFonts[11].setFamily(LyXFont::MSA_FAMILY);
|
||||
MathFonts[12].setFamily(LyXFont::MSB_FAMILY);
|
||||
|
||||
for (int i = 0; i < LM_FONT_END; ++i)
|
||||
font_available_initialized[i] = false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
LyXFont WhichFont(MathTextCodes type, MathStyles size)
|
||||
LyXFont const & whichFontBase(MathTextCodes type)
|
||||
{
|
||||
LyXFont f;
|
||||
|
||||
if (!Math_Fonts)
|
||||
if (!MathFonts)
|
||||
mathed_init_fonts();
|
||||
|
||||
switch (type) {
|
||||
case LM_TC_SYMB:
|
||||
case LM_TC_BSYM:
|
||||
f = Math_Fonts[2];
|
||||
break;
|
||||
return MathFonts[2];
|
||||
|
||||
case LM_TC_VAR:
|
||||
case LM_TC_IT:
|
||||
f = Math_Fonts[0];
|
||||
break;
|
||||
return MathFonts[0];
|
||||
|
||||
case LM_TC_BF:
|
||||
f = Math_Fonts[3];
|
||||
break;
|
||||
|
||||
case LM_TC_SF:
|
||||
f = Math_Fonts[7];
|
||||
break;
|
||||
return MathFonts[3];
|
||||
|
||||
case LM_TC_CAL:
|
||||
f = Math_Fonts[4];
|
||||
break;
|
||||
return MathFonts[4];
|
||||
|
||||
case LM_TC_TT:
|
||||
f = Math_Fonts[5];
|
||||
break;
|
||||
return MathFonts[5];
|
||||
|
||||
case LM_TC_TEXTRM:
|
||||
case LM_TC_CONST:
|
||||
case LM_TC_TEX:
|
||||
case LM_TC_RM:
|
||||
f = Math_Fonts[6];
|
||||
break;
|
||||
return MathFonts[6];
|
||||
|
||||
case LM_TC_SF:
|
||||
return MathFonts[7];
|
||||
|
||||
case LM_TC_CMSY:
|
||||
return MathFonts[8];
|
||||
|
||||
case LM_TC_CMM:
|
||||
return MathFonts[9];
|
||||
|
||||
case LM_TC_CMEX:
|
||||
return MathFonts[10];
|
||||
|
||||
case LM_TC_MSA:
|
||||
return MathFonts[11];
|
||||
|
||||
case LM_TC_MSB:
|
||||
return MathFonts[12];
|
||||
|
||||
default:
|
||||
f = Math_Fonts[1];
|
||||
break;
|
||||
}
|
||||
return MathFonts[1];
|
||||
}
|
||||
|
||||
|
||||
LyXFont whichFont(MathTextCodes type, MathStyles size)
|
||||
{
|
||||
LyXFont f = whichFontBase(type);
|
||||
|
||||
switch (size) {
|
||||
case LM_ST_DISPLAY:
|
||||
if (type == LM_TC_BSYM) {
|
||||
if (type == LM_TC_BSYM || type == LM_TC_CMEX) {
|
||||
f.incSize();
|
||||
f.incSize();
|
||||
}
|
||||
@ -213,15 +235,18 @@ LyXFont WhichFont(MathTextCodes type, MathStyles size)
|
||||
return f;
|
||||
}
|
||||
|
||||
char const * math_font_name[] = {
|
||||
"mathrm",
|
||||
"mathcal",
|
||||
"mathbf",
|
||||
"mathsf",
|
||||
"mathtt",
|
||||
"mathit",
|
||||
"textrm"
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
bool math_font_available(MathTextCodes type)
|
||||
{
|
||||
if (!font_available_initialized[type]) {
|
||||
font_available_initialized[type] = true;
|
||||
font_available[type] =
|
||||
fontloader.available(whichFontBase(type));
|
||||
}
|
||||
return font_available[type];
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
@ -500,7 +525,7 @@ deco_struct const * search_deco(int code)
|
||||
void mathed_char_dim(MathTextCodes type, MathStyles size, unsigned char c,
|
||||
int & asc, int & des, int & wid)
|
||||
{
|
||||
LyXFont const font = WhichFont(type, size);
|
||||
LyXFont const font = whichFont(type, size);
|
||||
des = lyxfont::descent(c, font);
|
||||
asc = lyxfont::ascent(c, font);
|
||||
wid = mathed_char_width(type, size, c);
|
||||
@ -510,7 +535,7 @@ void mathed_char_dim(MathTextCodes type, MathStyles size, unsigned char c,
|
||||
int mathed_char_height(MathTextCodes type, MathStyles size, unsigned char c,
|
||||
int & asc, int & des)
|
||||
{
|
||||
LyXFont const font = WhichFont(type, size);
|
||||
LyXFont const font = whichFont(type, size);
|
||||
des = lyxfont::descent(c, font);
|
||||
asc = lyxfont::ascent(c, font);
|
||||
return asc + des;
|
||||
@ -524,23 +549,28 @@ int mathed_char_height(MathTextCodes type, MathStyles size, unsigned char c)
|
||||
return mathed_char_height(type, size, c, asc, des);
|
||||
}
|
||||
|
||||
|
||||
int mathed_char_ascent(MathTextCodes type, MathStyles size, unsigned char c)
|
||||
{
|
||||
LyXFont const font = WhichFont(type, size);
|
||||
LyXFont const font = whichFont(type, size);
|
||||
return lyxfont::ascent(c, font);
|
||||
}
|
||||
|
||||
|
||||
int mathed_char_descent(MathTextCodes type, MathStyles size, unsigned char c)
|
||||
{
|
||||
LyXFont const font = WhichFont(type, size);
|
||||
LyXFont const font = whichFont(type, size);
|
||||
return lyxfont::descent(c, font);
|
||||
}
|
||||
|
||||
|
||||
int mathed_char_width(MathTextCodes type, MathStyles size, unsigned char c)
|
||||
{
|
||||
LyXFont const font = WhichFont(type, size);
|
||||
if (isBinaryOp(c))
|
||||
return lyxfont::width(c, font) + 2 * lyxfont::width(' ', font);
|
||||
LyXFont const font = whichFont(type, size);
|
||||
LyXFont const f1 = whichFont(LM_TC_TEXTRM, size);
|
||||
#warning why f1 is used ?
|
||||
if (isBinaryOp(c, type))
|
||||
return lyxfont::width(c, font) + 2 * lyxfont::width(' ', f1);
|
||||
else
|
||||
return lyxfont::width(c, font);
|
||||
}
|
||||
@ -553,10 +583,11 @@ void mathed_string_dim(MathTextCodes type, MathStyles size, string const & s,
|
||||
wid = mathed_string_width(type, size, s);
|
||||
}
|
||||
|
||||
|
||||
int mathed_string_height(MathTextCodes type, MathStyles size, string const & s,
|
||||
int & asc, int & des)
|
||||
{
|
||||
LyXFont const font = WhichFont(type, size);
|
||||
LyXFont const font = whichFont(type, size);
|
||||
asc = des = 0;
|
||||
for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
|
||||
des = max(des, lyxfont::descent(*it, font));
|
||||
@ -565,9 +596,10 @@ int mathed_string_height(MathTextCodes type, MathStyles size, string const & s,
|
||||
return asc + des;
|
||||
}
|
||||
|
||||
|
||||
int mathed_string_width(MathTextCodes type, MathStyles size, string const & s)
|
||||
{
|
||||
return lyxfont::width(s, WhichFont(type, size));
|
||||
return lyxfont::width(s, whichFont(type, size));
|
||||
}
|
||||
|
||||
|
||||
@ -577,7 +609,7 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
|
||||
Matrix mt;
|
||||
Matrix sqmt;
|
||||
int i = 0;
|
||||
string name = l->name;
|
||||
string const & name = l->name;
|
||||
int code = (name.size() > 1) ? l->id : name[0];
|
||||
|
||||
if (name == ".") {
|
||||
@ -589,7 +621,7 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
|
||||
deco_struct const * mds = search_deco(code);
|
||||
if (!mds) {
|
||||
lyxerr << "Deco was not found. Programming error?\n";
|
||||
lyxerr << "name: '" << l->name << "', code: " << code << "\n";
|
||||
lyxerr << "name: '" << name << "', code: " << code << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -661,11 +693,11 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
|
||||
}
|
||||
|
||||
|
||||
// In a near future maybe we use a better fonts renderer
|
||||
// In the future maybe we use a better fonts renderer
|
||||
void drawStr(Painter & pain, MathTextCodes type, MathStyles siz,
|
||||
int x, int y, string const & s)
|
||||
{
|
||||
pain.text(x, y, s, WhichFont(type, siz));
|
||||
pain.text(x, y, s, whichFont(type, siz));
|
||||
}
|
||||
|
||||
|
||||
@ -673,14 +705,15 @@ void drawChar
|
||||
(Painter & pain, MathTextCodes type, MathStyles siz, int x, int y, char c)
|
||||
{
|
||||
string s;
|
||||
if (isBinaryOp(c))
|
||||
if (isBinaryOp(c, type))
|
||||
s += ' ';
|
||||
s += c;
|
||||
if (isBinaryOp(c))
|
||||
if (isBinaryOp(c, type))
|
||||
s += ' ';
|
||||
drawStr(pain, type, siz, x, y, s);
|
||||
}
|
||||
|
||||
|
||||
// decrease math size for super- and subscripts
|
||||
MathStyles smallerStyleScript(MathStyles st)
|
||||
{
|
||||
@ -692,6 +725,7 @@ MathStyles smallerStyleScript(MathStyles st)
|
||||
return st;
|
||||
}
|
||||
|
||||
|
||||
// decrease math size for fractions
|
||||
MathStyles smallerStyleFrac(MathStyles st)
|
||||
{
|
||||
@ -706,11 +740,12 @@ MathStyles smallerStyleFrac(MathStyles st)
|
||||
|
||||
void math_font_max_dim(MathTextCodes code, MathStyles siz, int & asc, int & des)
|
||||
{
|
||||
LyXFont font = WhichFont(code, siz);
|
||||
LyXFont font = whichFont(code, siz);
|
||||
asc = lyxfont::maxAscent(font);
|
||||
des = lyxfont::maxDescent(font);
|
||||
}
|
||||
|
||||
|
||||
char const * latex_mathspace[] = {
|
||||
"!", ",", ":", ";", "quad", "qquad"
|
||||
};
|
||||
|
@ -9,7 +9,6 @@
|
||||
class Painter;
|
||||
class latexkeys;
|
||||
|
||||
extern char const * math_font_name[];
|
||||
extern char const * latex_mathspace[];
|
||||
|
||||
int mathed_char_height(MathTextCodes type, MathStyles size, unsigned char c,
|
||||
@ -40,4 +39,6 @@ void drawChar(Painter & pain, MathTextCodes type, MathStyles siz,
|
||||
void math_font_max_dim
|
||||
(MathTextCodes code, MathStyles siz, int & asc, int & desc);
|
||||
|
||||
bool math_font_available(MathTextCodes code);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user