Commit 55a3a9df authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

Math Run Properties :

1. bold, italic
2. sty: fraktur
3. sty: plain (text)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55608 954022d7-b5bf-4e40-9824-e11837661b57
parent d8888c2a
......@@ -3973,8 +3973,14 @@ ParaRun.prototype =
var oWPrp = this.Parent.Get_Default_TPrp();
TextPr.Merge(oWPrp);
TextPr.Merge( this.Pr ); // Мержим прямые настройки данного рана
this.Parent.applyArgSize(TextPr);
if(!this.MathPrp.nor) // math text, style: plain
{
var MPrp = this.MathPrp.getTxtPrp();
TextPr.Merge(MPrp); // bold, italic
}
this.Parent.applyArgSize(TextPr);
}
else
TextPr.Merge( this.Pr ); // Мержим прямые настройки данного рана
......@@ -6562,10 +6568,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
var X = x;
var Y = y + this.size.ascent;
// var oWPrp = this.Get_CompiledPr(true);
var oWPrp = this.Pr.Copy();
this.Parent.applyArgSize(oWPrp);
var oWPrp = this.Get_CompiledPr(true);
oWPrp.Italic = false;
pGraphics.SetFont(oWPrp);
......@@ -6589,20 +6592,15 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
var width = 0,
ascent = 0, descent = 0;
var oWPrp = this.Pr.Copy();
this.Parent.applyArgSize(oWPrp);
var oWPrp = this.Get_CompiledPr(true);
oWPrp.Italic = false;
// TODO
// смержить еще с math_Run_Prp
g_oTextMeasurer.SetFont(oWPrp);
for (var Pos = 0 ; Pos < this.Content.length; Pos++ )
{
RecalcInfo.leftRunPrp = RecalcInfo.currRunPrp;
RecalcInfo.Left = RecalcInfo.Current;
......@@ -6610,8 +6608,7 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
RecalcInfo.Current = this.Content[Pos];
RecalcInfo.setGaps();
var compiledTPrp = this.Get_CompiledPr(true);
this.Content[Pos].relate(this);
this.Content[Pos].Resize(g_oTextMeasurer);
var oSize = this.Content[Pos].size;
......@@ -6620,6 +6617,7 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
ascent = ascent > oSize.ascent ? ascent : oSize.ascent;
var oDescent = oSize.height - oSize.ascent;
descent = descent < oDescent ? oDescent : descent;
}
this.size = {width: width, height: ascent + descent, ascent: ascent};
......@@ -6694,3 +6692,7 @@ ParaRun.prototype.Set_MathPrp = function(props)
{
this.MathPrp.setMathProps(props);
}
ParaRun.prototype.Math_GetTypeText = function()
{
return this.MathPrp.getTypeText();
}
\ No newline at end of file
......@@ -10182,7 +10182,6 @@ function Binary_oMathReader(stream)
if (c_oSer_OMathContentType.MText === type)
{
var text = this.stream.GetString2LE(length);
var str = "";
for (var i = 0; i < text.length; ++i)
{
//управляющие символы
......@@ -10197,6 +10196,7 @@ function Binary_oMathReader(stream)
oMRun.Content.splice(oMRun.Content.length, 0, new ParaSpace(1));
*/
}
oMRun.Set_MathPrp(props);
oParent.addElementToContent(oMRun);
}
......
......@@ -746,7 +746,7 @@ CMPrp.prototype =
this.SetBProp(this.aln, props.aln);
this.SetBProp(this.brk, props.brk);
this.SetBProp(this.lit, props.lit);
//this.SetBProp(this.nor, props.nor);
// если приходит несколько параметров style из xml, то запоминается последний
if(props.sty === "i")
......@@ -783,6 +783,20 @@ CMPrp.prototype =
this.typeText = TXT_NORMAL;
},
getTypeText: function()
{
var type;
if(this.plain && this.typeText == TXT_ROMAN)
type = TXT_NORMAL;
else
type = this.typeText;
if(this.nor)
type = TXT_NORMAL;
return type;
},
getTxtSettings: function()
{
var type = this.typeText;
......@@ -802,8 +816,8 @@ CMPrp.prototype =
{
var textPrp = new CTextPr();
textPrp.italic = this.italic;
textPrp.bold = this.bold;
textPrp.Italic = this.italic;
textPrp.Bold = this.bold;
if(this.typeText == TXT_ROMAN)
textPrp.Italic = false;
......
......@@ -100,16 +100,22 @@ CMathText.prototype =
{
var code = this.value;
if(this.typeObj === MATH_PLACEHOLDER)
return code;
var bCapitale = (code > 0x0040 && code < 0x005B),
bSmall = (code > 0x0060 && code < 0x007b);
if(this.type == TXT_ROMAN )
var Type = this.Parent.Math_GetTypeText();
//var Type = TXT_ROMAN;
if(Type == TXT_ROMAN )
{
var bDigit = (code > 0x002F && code < 0x003A),
bCapGreek = (code > 0x0390 && code < 0x03AA ),
bSmallGreek = (code > 0x03B0 && code < 0x03CA);
if(code == 0x0068) // h
if(code == 0x68) // h
code = 0x210E;
else if(bCapitale)
code = code + 0x1D3F3;
......@@ -125,35 +131,45 @@ CMathText.prototype =
else if(code == 0x237) // "j" without dot
code = 0x1D6A5;
}
else if(this.type == TXT_DOUBLE_STRUCK)
else if(Type == TXT_DOUBLE_STRUCK)
{
if(bCapitale)
code = code + 0x1D4F8;
else if(bSmall)
code = code + 0x1D4F2;
}
else if(this.type == TXT_MONOSPACE)
else if(Type == TXT_MONOSPACE)
{
if(bCapitale)
code = code + 0x1D630;
else if(bSmall)
code = code + 0x1D62A;
}
else if(this.type == TXT_FRAKTUR)
{
if(bCapitale)
code = code + 0x1D4C4;
else if(Type == TXT_FRAKTUR)
{
if(code == 0x43)
code = 0x212D;
else if(code == 0x48)
code = 0x210C;
else if(code == 0x49)
code = 0x2111;
else if(code == 0x52)
code = 0x211C;
else if(code == 0x5A)
code = 0x2128;
else if(bCapitale)
code = code + 0x1D4C3;
else if(bSmall)
code = code + 0x1D4BE;
code = code + 0x1D4BD;
}
else if(this.type == TXT_SANS_SERIF)
else if(Type == TXT_SANS_SERIF)
{
if(bCapitale)
code = code + 0x1D5CB;
else if(bSmall)
code = code + 0x1D5C5;
}
else if(this.type == TXT_SCRIPT)
else if(Type == TXT_SCRIPT)
{
if(bCapitale)
code = code + 0x1D45C;
......@@ -423,7 +439,7 @@ CMathText.prototype =
{
this.bJDraw = bJustDraw;
},
setMText: function(type)
SetTypeText: function(type)
{
this.type = type;
},
......@@ -460,7 +476,6 @@ CMathText.prototype =
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.bPlaceholder = true;
},
......
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