Kaydet (Commit) a05cd16e authored tarafından Thomas Lange [tl]'s avatar Thomas Lange [tl]

tl76: #i106815#: Math related changes because of the new OpenSymbol font

üst 1fc7845f
......@@ -31,9 +31,9 @@
#define TYPES_HXX
#include <sal/types.h>
#include <tools/debug.hxx>
#define FONTNAME_MATH "StarSymbol"
#define FONTNAME_MATH2 "OpenSymbol"
#define FONTNAME_MATH "OpenSymbol"
/////////////////////////////////////////////////////////////////
......@@ -54,19 +54,8 @@ inline sal_Bool IsInPrivateUseArea( sal_Unicode cChar ) { return 0xE000 <= cChar
inline sal_Bool IsGreekChar( sal_Unicode cChar ) { return 0x0370 <= cChar && cChar <= 0x03FF; }
sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar );
#ifdef TL_NOT_YET_USED
sal_Unicode ConvertUnicodeToMathPrivateUseArea( sal_Unicode cChar );
sal_Unicode ConvertMathToMathType( sal_Unicode cChar );
sal_Unicode ConvertMathTypeToMath( sal_Unicode cChar );
#endif //TL_NOT_YET_USED
sal_Unicode ConvertMathToMathML( sal_Unicode cChar );
#ifdef TL_NOT_YET_USED
sal_Unicode ConvertMathMLToMath( sal_Unicode cChar );
sal_Unicode GetTokenChar( sal_Unicode cChar, sal_Bool bConvertForExport );
#endif //TL_NOT_YET_USED
/////////////////////////////////////////////////////////////////
// enum definitions for characters from the 'StarSymbol' font
......@@ -84,14 +73,14 @@ enum MathSymbol
MS_DRARROW = (sal_Unicode) 0x21D2,
MS_DLARROW = (sal_Unicode) 0x21D0,
MS_DLRARROW = (sal_Unicode) 0x21D4,
MS_UNDERBRACE = (sal_Unicode) 0xE081,
MS_OVERBRACE = (sal_Unicode) 0xE082,
MS_CIRC = (sal_Unicode) 0x00B0,
MS_OVERBRACE = (sal_Unicode) 0x23DE,
MS_UNDERBRACE = (sal_Unicode) 0x23DF,
MS_CIRC = (sal_Unicode) 0x2218,
MS_ASSIGN = (sal_Unicode) 0x003D,
MS_ERROR = (sal_Unicode) 0x00BF,
MS_NEQ = (sal_Unicode) 0x2260,
MS_PLUS = (sal_Unicode) 0xE083,
MS_PLUS = (sal_Unicode) 0x002B,
MS_MINUS = (sal_Unicode) 0x2212,
MS_MULTIPLY = (sal_Unicode) 0x2217,
MS_TIMES = (sal_Unicode) 0x00D7,
......@@ -107,23 +96,23 @@ enum MathSymbol
MS_UNION = (sal_Unicode) 0x222A,
MS_INTERSECT = (sal_Unicode) 0x2229,
MS_LT = (sal_Unicode) 0xE084,
MS_GT = (sal_Unicode) 0xE085,
MS_LT = (sal_Unicode) 0x003C,
MS_GT = (sal_Unicode) 0x003E,
MS_LE = (sal_Unicode) 0x2264,
MS_GE = (sal_Unicode) 0x2265,
MS_LESLANT = (sal_Unicode) 0xE086,
MS_GESLANT = (sal_Unicode) 0xE087,
MS_LESLANT = (sal_Unicode) 0x2A7D,
MS_GESLANT = (sal_Unicode) 0x2A7E,
MS_LL = (sal_Unicode) 0x226A,
MS_GG = (sal_Unicode) 0x226B,
MS_SIM = (sal_Unicode) 0x007E,
MS_SIM = (sal_Unicode) 0x223C,
MS_SIMEQ = (sal_Unicode) 0x2243,
MS_APPROX = (sal_Unicode) 0x2248,
MS_DEF = (sal_Unicode) 0x225D,
MS_EQUIV = (sal_Unicode) 0x2261,
MS_PROP = (sal_Unicode) 0x221D,
MS_PARTIAL = (sal_Unicode) 0x2202,
MS_SUBSET = (sal_Unicode) 0x2282,
MS_SUBSET = (sal_Unicode) 0x2282,
MS_SUPSET = (sal_Unicode) 0x2283,
MS_SUBSETEQ = (sal_Unicode) 0x2286,
MS_SUPSETEQ = (sal_Unicode) 0x2287,
......@@ -143,70 +132,69 @@ enum MathSymbol
MS_LINE = (sal_Unicode) 0x2223,
MS_DLINE = (sal_Unicode) 0x2225,
MS_ORTHO = (sal_Unicode) 0x22A5,
MS_DOTSLOW = (sal_Unicode) 0xE08B,
MS_DOTSLOW = (sal_Unicode) 0x2026,
MS_DOTSAXIS = (sal_Unicode) 0x22EF,
MS_DOTSVERT = (sal_Unicode) 0x22EE,
MS_DOTSUP = (sal_Unicode) 0x22F0,
MS_DOTSDOWN = (sal_Unicode) 0x22F1,
MS_TRANSR = (sal_Unicode) 0x22B6,
MS_TRANSL = (sal_Unicode) 0x22B7,
MS_RIGHTARROW = (sal_Unicode) 0xE08C,
MS_BACKSLASH = (sal_Unicode) 0x2216,
MS_NEG = (sal_Unicode) 0x00AC,
MS_FORALL = (sal_Unicode) 0x2200,
MS_NABLA = (sal_Unicode) 0x2207,
MS_PROD = (sal_Unicode) 0x220F,
MS_COPROD = (sal_Unicode) 0x2210,
MS_SUM = (sal_Unicode) 0x2211,
MS_SQRT = (sal_Unicode) 0x221A,
MS_INT = (sal_Unicode) 0x222B,
MS_IINT = (sal_Unicode) 0x222C,
MS_IIINT = (sal_Unicode) 0x222D,
MS_LINT = (sal_Unicode) 0x222E,
MS_LLINT = (sal_Unicode) 0x222F,
MS_LLLINT = (sal_Unicode) 0x2230,
MS_SQRT = (sal_Unicode) 0xE08D,
MS_COPROD = (sal_Unicode) 0x2210,
MS_PROD = (sal_Unicode) 0x220F,
MS_SUM = (sal_Unicode) 0x2211,
MS_NABLA = (sal_Unicode) 0x2207,
MS_FORALL = (sal_Unicode) 0x2200,
MS_HAT = (sal_Unicode) 0xE091,
MS_CHECK = (sal_Unicode) 0xE092,
MS_BREVE = (sal_Unicode) 0xE093,
MS_ACUTE = (sal_Unicode) 0xE094,
MS_GRAVE = (sal_Unicode) 0xE095,
MS_TILDE = (sal_Unicode) 0xE096,
MS_BAR = (sal_Unicode) 0xE097,
MS_VEC = (sal_Unicode) 0xE098,
MS_GRAVE = (sal_Unicode) 0x0300,
MS_ACUTE = (sal_Unicode) 0x0301,
MS_HAT = (sal_Unicode) 0x0302,
MS_TILDE = (sal_Unicode) 0x0303,
MS_BAR = (sal_Unicode) 0x0304,
MS_BREVE = (sal_Unicode) 0x0306,
MS_CIRCLE = (sal_Unicode) 0x030A,
MS_CHECK = (sal_Unicode) 0x030C,
MS_VEC = (sal_Unicode) 0x20D7,
MS_DOT = (sal_Unicode) 0x02D9,
MS_DDOT = (sal_Unicode) 0x00A8,
MS_DDDOT = (sal_Unicode) 0xE09B,
MS_CIRCLE = (sal_Unicode) 0x02DA,
MS_DDDOT = (sal_Unicode) 0x20DB,
MS_AND = (sal_Unicode) 0x2227,
MS_OR = (sal_Unicode) 0x2228,
MS_NI = (sal_Unicode) 0x220B,
MS_EMPTYSET = (sal_Unicode) 0x2205,
MS_LBRACE = (sal_Unicode) 0x007B,
MS_RBRACE = (sal_Unicode) 0x007D,
MS_LPARENT = (sal_Unicode) 0xE09E,
MS_RPARENT = (sal_Unicode) 0xE09F,
MS_LANGLE = (sal_Unicode) 0x2329,
MS_RANGLE = (sal_Unicode) 0x232A,
MS_LPARENT = (sal_Unicode) 0x0028,
MS_RPARENT = (sal_Unicode) 0x0029,
MS_LBRACKET = (sal_Unicode) 0x005B,
MS_RBRACKET = (sal_Unicode) 0x005D,
MS_LDBRACKET = (sal_Unicode) 0x301A,
MS_RDBRACKET = (sal_Unicode) 0x301B,
MS_PLACE = (sal_Unicode) 0xE0AA,
MS_LBRACE = (sal_Unicode) 0x007B,
MS_RBRACE = (sal_Unicode) 0x007D,
MS_LCEIL = (sal_Unicode) 0x2308,
MS_LFLOOR = (sal_Unicode) 0x230A,
MS_RCEIL = (sal_Unicode) 0x2309,
MS_LFLOOR = (sal_Unicode) 0x230A,
MS_RFLOOR = (sal_Unicode) 0x230B,
MS_LANGLE = (sal_Unicode) 0x2329,
MS_RANGLE = (sal_Unicode) 0x232A,
MS_LDBRACKET = (sal_Unicode) 0x27E6,
MS_RDBRACKET = (sal_Unicode) 0x27E7,
MS_PLACE = (sal_Unicode) 0x2751,
MS_HBAR = (sal_Unicode) 0x210F,
MS_LAMBDABAR = (sal_Unicode) 0x019B,
MS_LEFTARROW = (sal_Unicode) 0xE0DB,
MS_UPARROW = (sal_Unicode) 0xE0DC,
MS_DOWNARROW = (sal_Unicode) 0xE0DD,
MS_HBAR = (sal_Unicode) 0x210F,
MS_LEFTARROW = (sal_Unicode) 0x2190,
MS_UPARROW = (sal_Unicode) 0x2191,
MS_RIGHTARROW = (sal_Unicode) 0x2192,
MS_DOWNARROW = (sal_Unicode) 0x2193,
MS_SETN = (sal_Unicode) 0x2115,
MS_SETZ = (sal_Unicode) 0x2124,
MS_SETQ = (sal_Unicode) 0x211A,
......
......@@ -49,7 +49,7 @@ static const USHORT aLatinDefFnts[FNT_END] =
DEFAULTFONT_SERIF, // FNT_SERIF
DEFAULTFONT_SANS, // FNT_SANS
DEFAULTFONT_FIXED // FNT_FIXED
//StarSymbol, // FNT_MATH
//OpenSymbol, // FNT_MATH
};
// CJK default-fonts
......@@ -65,7 +65,7 @@ static const USHORT aCJKDefFnts[FNT_END] =
DEFAULTFONT_CJK_TEXT, // FNT_SERIF
DEFAULTFONT_CJK_DISPLAY, // FNT_SANS
DEFAULTFONT_CJK_TEXT // FNT_FIXED
//StarSymbol, // FNT_MATH
//OpenSymbol, // FNT_MATH
};
// CTL default-fonts
......@@ -78,7 +78,7 @@ static const USHORT aCTLDefFnts[FNT_END] =
DEFAULTFONT_CTL_TEXT, // FNT_SERIF
DEFAULTFONT_CTL_TEXT, // FNT_SANS
DEFAULTFONT_CTL_TEXT // FNT_FIXED
//StarSymbol, // FNT_MATH
//OpenSymbol, // FNT_MATH
};
......
......@@ -1651,7 +1651,7 @@ void SmBraceNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat)
"Sm : unterschiedliche Fontgroessen");
aTmpSize.Width() = Min((long) nBraceHeight * 60L / 100L,
rFormat.GetBaseSize().Height() * 3L / 2L);
// correction factor since change from StarMath to StarSymbol font
// correction factor since change from StarMath to OpenSymbol font
// because of the different font width in the FontMetric
aTmpSize.Width() *= 182;
aTmpSize.Width() /= 267;
......@@ -2694,7 +2694,7 @@ void SmMathSymbolNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocSh
DBG_ASSERT(GetFont().GetCharSet() == RTL_TEXTENCODING_SYMBOL ||
GetFont().GetCharSet() == RTL_TEXTENCODING_UNICODE,
"incorrect charset for character from StarMath/StarSymbol font");
"incorrect charset for character from StarMath/OpenSymbol font");
Flags() |= FLG_FONT | FLG_ITALIC;
};
......
......@@ -150,8 +150,7 @@ void SmRect::BuildRect(const OutputDevice &rDev, const SmFormat *pFormat,
aSize = Size(rDev.GetTextWidth(rText), rDev.GetTextHeight());
const FontMetric aFM (rDev.GetFontMetric());
BOOL bIsMath = aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH ) ||
aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH2 );
BOOL bIsMath = aFM.GetName().EqualsIgnoreCaseAscii( FONTNAME_MATH );
BOOL bAllowSmaller = bIsMath && !SmIsMathAlpha(rText);
const long nFontHeight = rDev.GetFont().GetSize().Height();
......
......@@ -35,227 +35,21 @@
#include <types.hxx>
//!! no official unicode code point for these in non-private-area
//!! (even MathMl uses the code points listed on the right which are
//!! from the private-use-area as well)
// MS_UNDERBRACE = (xub_Unicode) 0xE081, 0xF613 ?
// MS_OVERBRACE = (xub_Unicode) 0xE082, 0xF612 ?
struct MathConversionEntry
{
sal_Unicode cMath; // code point of the character from the
// StarSymbol/OpenSymbol private-use-area
sal_Unicode cUnicode; // 'official' Unicode code point the above
// character should be matched to and vice versa.
// See http://www.w3.org/TR/2000/WD-MathML2-20000211/bycodes.html
// for most of them.
// const sal_Unicode *pFontName;
sal_Unicode cMathType; // 0 if the same value of cUnicode is to be used
};
static MathConversionEntry aMathConvTbl[] =
{
// MS_UNDERBRACE, 0xF613, // only Math-ML code-point available !
// MS_OVERBRACE, 0xF612, // only Math-ML code-point available !
{ MS_PLUS, 0x002B, 0 },
{ MS_LT, 0x003C, 0 },
{ MS_GT, 0x003E, 0 },
{ MS_LESLANT, 0x2264, 0 },
{ MS_GESLANT, 0x2265, 0 },
{ MS_DOTSLOW, 0x2026, 0 },
{ MS_RIGHTARROW, 0x2192, 0 },
{ MS_SQRT, 0x221A, 0 },
{ MS_HAT, 0x02C6, 0 },
{ MS_CHECK, 0x02C7, 0 },
{ MS_BREVE, 0x02D8, 0 },
{ MS_ACUTE, 0x00B4, 0 },
{ MS_GRAVE, 0x0060, 0 },
{ MS_TILDE, 0x02DC, 0 },
{ MS_BAR, 0x02C9, 0 },
{ MS_VEC, 0x2192, 0 },
{ MS_DDDOT, 0x22EF, 0 },
{ MS_LPARENT, 0x0028, 0 },
{ MS_RPARENT, 0x0029, 0 },
{ MS_PLACE, 0x25A1, 0 },
{ MS_LEFTARROW, 0x2190, 0 },
{ MS_UPARROW, 0x2191, 0 },
{ MS_DOWNARROW, 0x2193, 0 },
{ MS_PLACE, 0x2751, 0 },
// predefined-user-defined symbols
// (code-points on the left as defined in 'officecfg' for SO8,
// non-private-use-area characters uncommented):
// 0x0041, 0x0391, 0, // %ALPHA
// 0x0042, 0x0392, 0, // %BETA
{ 0xE0AC, 0x0393, 0 }, // %GAMMA
{ 0xE0AD, 0x0394, 0 }, // %DELTA
// 0x0045, 0x0395, 0, // %EPSILON
// 0x005A, 0x0396, 0, // %ZETA
// 0x0048, 0x0397, 0, // %ETA
{ 0xE0AE, 0x0398, 0 }, // %THETA
// 0x0049, 0x0399, 0, // %IOTA
// 0x004B, 0x039A, 0, // %KAPPA
{ 0xE0AF, 0x039B, 0 }, // %LAMBDA
// 0x004D, 0x039C, 0, // %MU
// 0x004E, 0x039D, 0, // %NU
{ 0xE0B0, 0x039E, 0 }, // %XI
// 0x004F, 0x039F, 0, // %OMICRON
{ 0xE0B1, 0x03A0, 0 }, // %PI
// 0x0050, 0x03A1, 0, // %RHO
{ 0xE0B2, 0x03A3, 0 }, // %SIGMA
// 0x0054, 0x03A4, 0, // %TAU
{ 0xE0B3, 0x03A5, 0 }, // %UPSILON
{ 0xE0B4, 0x03A6, 0 }, // %PHI
// 0x0058, 0x03A7, 0, // %CHI
{ 0xE0B5, 0x03A8, 0 }, // %PSI
{ 0xE0B6, 0x03A9, 0 }, // %OMEGA
{ 0xE0B7, 0x03B1, 0 }, // %alpha
{ 0xE0B8, 0x03B2, 0 }, // %beta
{ 0xE0B9, 0x03B3, 0 }, // %gamma
{ 0xE0BA, 0x03B4, 0 }, // %delta
{ 0xE0BB, 0x03B5, 0 }, // %epsilon
{ 0xE0BC, 0x03B6, 0 }, // %zeta
{ 0xE0BD, 0x03B7, 0 }, // %eta
{ 0xE0BE, 0x03B8, 0 }, // %theta
{ 0xE0BF, 0x03B9, 0 }, // %iota
{ 0xE0C0, 0x03BA, 0 }, // %kappa
{ 0xE0C1, 0x03BB, 0 }, // %lambda
{ 0xE0C2, 0x03BC, 0 }, // %mu
{ 0xE0C3, 0x03BD, 0 }, // %nu
{ 0xE0C4, 0x03BE, 0 }, // %xi
{ 0xE0C5, 0x03BF, 0 }, // %omicron
{ 0xE0C6, 0x03C0, 0 }, // %pi
{ 0xE0C7, 0x03C1, 0 }, // %rho
{ 0xE0C8, 0x03C3, 0 }, // %sigma
{ 0xE0C9, 0x03C4, 0 }, // %tau
{ 0xE0CA, 0x03C5, 0 }, // %upsilon
{ 0xE0CB, 0x03C6, 0 }, // %phi
{ 0xE0CC, 0x03C7, 0 }, // %chi
{ 0xE0CD, 0x03C8, 0 }, // %psi
{ 0xE0CE, 0x03C9, 0 }, // %omega
{ 0xE0CF, 0x025B, 0,/*x03B5*/}, // %varepsilon
{ 0xE0D0, 0x03D1, 0 }, // %vartheta
{ 0xE0D4, 0x03D5, 0 }, // %varphi
{ 0xE0D1, 0x03D6, 0 }, // %varpi
// 0x03F1, 0x03F1, 0/*x03C1*/, // %varrho
{ 0xE0D3, 0x03C2, 0 }, // %varsigma
// 0x2227, 0x2227, 0, // %and
// 0x2228, 0x2228, 0, // %or
// 0x2208, 0x2208, 0, // %element
// 0x2209, 0x2209, 0, // %noelement
// 0x226B, 0x226B, 0, // %strictlygreaterthan
// 0x226A, 0x226A, 0, // %strictlylessthan
// 0x2261, 0x2261, 0, // %identical
// 0x221E, 0x221E, 0, // %infinite
// 0x2260, 0x2260, 0, // %notequal
{ 0xE080, 0x2030, 0 }, // %perthousand
// 0x2222, 0x2222, 0, // %angle
{ 0xE08C, 0x2192, 0 } // %tendto
};
static int nMathToUnicodeLen = sizeof(aMathConvTbl) / sizeof(aMathConvTbl[0]);
sal_Unicode ConvertMathPrivateUseAreaToUnicode( sal_Unicode cChar )
{
sal_Unicode cRes = 0;
sal_Unicode cRes = cChar;
if (IsInPrivateUseArea( cChar ))
{
for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i)
{
if (aMathConvTbl[i].cMath == cChar)
cRes = aMathConvTbl[i].cUnicode;
}
}
return cRes;
}
#ifdef TL_NOT_YET_USED
sal_Unicode ConvertUnicodeToMathPrivateUseArea( sal_Unicode cChar )
{
sal_Unicode cRes = 0;
for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i)
{
if (aMathConvTbl[i].cUnicode == cChar)
cRes = aMathConvTbl[i].cMath;
}
return cRes;
}
sal_Unicode ConvertMathToMathType( sal_Unicode cChar )
{
sal_Unicode cRes = 0;
for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i)
{
const MathConversionEntry &rEntry = aMathConvTbl[i];
if (rEntry.cMath == cChar)
{
cRes = rEntry.cMathType;
if (cRes == 0)
cRes = rEntry.cUnicode;
}
DBG_ASSERT( 0, "Error: private use area characters should no longer be in use!" );
cRes = ''; // just some character that should easily be notice as odd in the context
}
return cRes;
}
sal_Unicode ConvertMathTypeToMath( sal_Unicode cChar )
{
sal_Unicode cRes = 0;
for (int i = 0; i < nMathToUnicodeLen && cRes == 0; ++i)
{
const MathConversionEntry &rEntry = aMathConvTbl[i];
sal_Unicode cTmp = rEntry.cMathType;
if (cTmp == 0)
cTmp = rEntry.cUnicode;
if (cTmp == cChar)
cRes = rEntry.cMath;
}
return cRes;
}
#endif //TL_NOT_YET_USED
sal_Unicode ConvertMathToMathML( sal_Unicode cChar )
{
sal_Unicode cRes = 0;
if (cChar == MS_OVERBRACE)
cRes = 0xF612; // Math-ML code-point (there is no official unicode-point)
else if (cChar == MS_UNDERBRACE)
cRes = 0xF613; // Math-ML code-point (there is no official unicode-point)
else
cRes = ConvertMathPrivateUseAreaToUnicode( cChar );
return cRes;
}
#ifdef TL_NOT_YET_USED
sal_Unicode ConvertMathMLToMath( sal_Unicode cChar )
{
sal_Unicode cRes = 0;
if (cChar == 0xF612)
cRes = MS_OVERBRACE; // Math-ML code-point (there is no official unicode-point)
else if (cChar == 0xF613)
cRes = MS_UNDERBRACE; // Math-ML code-point (there is no official unicode-point)
else
cRes = ConvertUnicodeToMathPrivateUseArea( cChar );
sal_Unicode cRes = ConvertMathPrivateUseAreaToUnicode( cChar );
return cRes;
}
sal_Unicode GetTokenChar( sal_Unicode cChar, sal_Bool bConvertForExport )
{
sal_Unicode cRes = cChar;
if (bConvertForExport)
{
sal_Unicode cTmp = ConvertMathPrivateUseAreaToUnicode( cChar );
if (cTmp != 0)
cRes = cTmp;
}
return cRes;
}
#endif //TL_NOT_YET_USED
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment