Commit 1969d577 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. Сделала смещение для диакритических элементов, в случае если style italic...

1. Сделала смещение для диакритических элементов, в случае если style italic или bold-italic, scr Roman или Sans-serif,
в контенте ровно одна буква (заглавная либо строчная) из латинского алфавита
2. Поправила баг : значок для диакритического элемента отрисовывался с текстовой настройкой bold, 
если такая же настройка в смерженнных CtrPrp для диакр элемента


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58520 954022d7-b5bf-4e40-9824-e11837661b57
parent 19074c20
...@@ -8044,6 +8044,18 @@ ParaRun.prototype.IsEqqArray = function() ...@@ -8044,6 +8044,18 @@ ParaRun.prototype.IsEqqArray = function()
{ {
return this.Parent.IsEqqArray(); return this.Parent.IsEqqArray();
} }
ParaRun.prototype.Math_GetInfoLetter = function(Info)
{
if(this.Content.length == 1)
{
var Compiled_MPrp = this.MathPrp.GetCompiled_ScrStyles();
Info.sty = Compiled_MPrp.sty;
Info.scr = Compiled_MPrp.scr;
this.Content[0].getInfoLetter(Info);
}
else
Info.Result = false;
}
function CParaRunStartState(Run) function CParaRunStartState(Run)
{ {
......
...@@ -387,7 +387,7 @@ CAccentBreve.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -387,7 +387,7 @@ CAccentBreve.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[22], YY[22]); pGraphics._l(XX[22], YY[22]);
} }
function CSign() /*function CSign()
{ {
this.sign = new CMathText(true); this.sign = new CMathText(true);
this.typeOper = null; this.typeOper = null;
...@@ -451,10 +451,10 @@ CSign.prototype.fixSize = function(oMeasure, stretch, bIncline) ...@@ -451,10 +451,10 @@ CSign.prototype.fixSize = function(oMeasure, stretch, bIncline)
this.sign.Resize(oMeasure); this.sign.Resize(oMeasure);
/*if(this.typeOper == ACCENT_THREE_DOTS) *//*if(this.typeOper == ACCENT_THREE_DOTS)
this.dH = 1.2*ctrPrp.FontSize/36; this.dH = 1.2*ctrPrp.FontSize/36;
else else
this.dH = 1.2*ctrPrp.FontSize/36;*/ this.dH = 1.2*ctrPrp.FontSize/36;*//*
//var height = this.sign.size.height + this.dH, //var height = this.sign.size.height + this.dH,
var height = this.sign.size.height, var height = this.sign.size.height,
...@@ -476,7 +476,7 @@ CSign.prototype.relate = function(parent) ...@@ -476,7 +476,7 @@ CSign.prototype.relate = function(parent)
CSign.prototype.getCodeCharacter = function() CSign.prototype.getCodeCharacter = function()
{ {
return this.sign.value; return this.sign.value;
} }*/
function CAccent(props) function CAccent(props)
{ {
...@@ -490,7 +490,6 @@ function CAccent(props) ...@@ -490,7 +490,6 @@ function CAccent(props)
chrType: null chrType: null
}; };
this.shiftX = 0;
this.gap = 0; this.gap = 0;
///////////////// /////////////////
...@@ -597,17 +596,7 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -597,17 +596,7 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.operator.fixSize(ParaMath, oMeasure, base.size.width); this.operator.fixSize(ParaMath, oMeasure, base.size.width);
if(this.operator.typeOper == OPERATOR_TEXT) var width = base.size.width, // (!)
{
var letterX = new CMathText(true);
letterX.add(0x78);
letterX.Resize(oMeasure, null);
//this.gap = this.operator.size.ascentSign - letterX.size.ascent;
}
var width = base.size.width > this.operator.size.width ? base.size.width : this.operator.size.width,
height = base.size.height + this.operator.size.height, height = base.size.height + this.operator.size.height,
ascent = this.operator.size.height + this.elements[0][0].size.ascent; ascent = this.operator.size.height + this.elements[0][0].size.ascent;
...@@ -621,21 +610,36 @@ CAccent.prototype.getBase = function() ...@@ -621,21 +610,36 @@ CAccent.prototype.getBase = function()
} }
CAccent.prototype.draw = function(x, y, pGraphics) CAccent.prototype.draw = function(x, y, pGraphics)
{ {
this.elements[0][0].draw(x, y, pGraphics); var base = this.elements[0][0];
base.draw(x, y, pGraphics);
var Info =
{
Result: true,
sty: null,
scr: null,
Latin: false,
Greek: false
};
var MergedCtrPrp = this.Get_CompiledCtrPrp(); base.getInfoLetter(Info);
var FontSize = MergedCtrPrp.FontSize,
FontFamily = {Name: "Cambria Math", Index: -1};
var obj = {FontSize: FontSize, FontFamily: FontFamily}; if(Info.Result == true)
{
var bStyle = Info.sty == STY_BI || Info.sty == STY_ITALIC,
bScript = Info.scr == TXT_ROMAN || Info.scr == TXT_SANS_SERIF;
var accFont = new CTextPr(); if(bStyle && bScript && (Info.Latin || Info.Greek))
accFont.Set_FromObject(obj); {
if(this.Pr.chr != 0x305 && this.Pr.chr >= 0x300 && this.Pr.chr <= 0x315 || this.Pr.chr == 0x20DB)
{
var ascent = this.elements[0][0].size.ascent;
x += ascent*0.1;
}
}
}
pGraphics.SetFont(accFont);
pGraphics.p_color(0,0,0, 255);
pGraphics.b_color1(0,0,0, 255);
this.operator.draw(x, y, pGraphics); this.operator.draw(x, y, pGraphics);
} }
......
...@@ -296,6 +296,25 @@ CCoeffGaps.prototype = ...@@ -296,6 +296,25 @@ CCoeffGaps.prototype =
return code == PLUS || code == MINUS || code == LESS || code == GREATER || code == PLUS_MINUS; return code == PLUS || code == MINUS || code == LESS || code == GREATER || code == PLUS_MINUS;
}, },
new_checkOperSign: function(code) // "+", "-", "<", ">", "±"
{
var PLUS = 0x2B,
MINUS = 0x2212,
LESS = 0x3C,
GREATER = 0x3E,
PLUS_MINUS = 0xB1;
var MATH_SiGN = code == PLUS || code == MINUS || code == LESS || code == GREATER || code == PLUS_MINUS;
var ARROWS = (code >= 0x2190 && code <= 0x21B3) || (code == 0x21B6) || (code == 0x21B7) || (code >= 0x21BA && code <= 0x21E9) && (code >=0x21F4 && code <=0x21FF);
var EQUALS = (code >= 0x2234 && code <= 0x22BD) || (code >= 0x22C4 && code <= 0x22FF);
var ARR_FISHES = (code >= 0x27DA && code <= 0x27E5) || (code >= 0x27EC && code <= 0x297F);
var TRIANGLE_SYMB = code >= 0x29CE && code <= 0x29D7;
var OTH_SYMB = code == 0x29DF || (code >= 0x29E1 && code <= 0x29E7) || (code >= 0x29F4 && code <= 0x29F8) || (code >= 0x2A22 && code <= 0x2AF0) || (code >= 0x2AF2 && code <= 0x2AFB)|| code == 0x2AFD || code == 0x2AFE;
return MATH_SiGN || ARROWS || EQUALS || ARR_FISHES || TRIANGLE_SYMB || OTH_SYMB;
//return code == PLUS || code == MINUS || code == LESS || code == GREATER || code == PLUS_MINUS;
},
checkZEROSign: function(code, direct) // "*", "/", "\" checkZEROSign: function(code, direct) // "*", "/", "\"
{ {
var MULT = 0x2217, var MULT = 0x2217,
...@@ -4277,6 +4296,13 @@ CMathContent.prototype = ...@@ -4277,6 +4296,13 @@ CMathContent.prototype =
setCtrPrp: function() setCtrPrp: function()
{ {
},
getInfoLetter: function(Info)
{
if(this.content.length == 1)
this.content[0].Math_GetInfoLetter(Info);
else
Info.Result = false;
}, },
IsPlaceholder: function() IsPlaceholder: function()
{ {
...@@ -7755,7 +7781,7 @@ CMathComposition.prototype = ...@@ -7755,7 +7781,7 @@ CMathComposition.prototype =
{ {
*//***** FOR FORMULA *****//* *//***** FOR FORMULA *****//*
// В документации везде, где нет примера использования свояства, означает, что Word не поддерживает это свойство ! // В документации везде, где нет примера использования свойства, означает, что Word не поддерживает это свойство !
if(props.naryLim == NARY_UndOvr || props.naryLim == NARY_SubSup) if(props.naryLim == NARY_UndOvr || props.naryLim == NARY_SubSup)
this.props.naryLim = props.naryLim; this.props.naryLim = props.naryLim;
......
...@@ -575,6 +575,20 @@ CMathText.prototype = ...@@ -575,6 +575,20 @@ CMathText.prototype =
} }
}, },
getInfoLetter: function(Info)
{
var code = this.value;
var bCapitale = (code > 0x0040 && code < 0x005B),
bSmall = (code > 0x0060 && code < 0x007b) || code == 0x131 || code == 0x237;
Info.Latin = bCapitale || bSmall;
var bCapGreek = (code > 0x0390 && code < 0x03AA),
bSmallGreek = (code > 0x03B0 && code < 0x03CA);
Info.Greek = bCapGreek || bSmallGreek;
},
setCoeffTransform: function(sx, shx, shy, sy) setCoeffTransform: function(sx, shx, shy, sy)
{ {
this.transform = {sx: sx, shx: shx, shy: shy, sy: sy}; this.transform = {sx: sx, shx: shx, shy: shy, sy: sy};
......
...@@ -2907,7 +2907,6 @@ COperator.prototype.getProps = function(props, defaultProps) ...@@ -2907,7 +2907,6 @@ COperator.prototype.getProps = function(props, defaultProps)
chr = props.chr, chr = props.chr,
type = props.type; type = props.type;
var code = props.chr; var code = props.chr;
this.defaultType = defaultProps.type; this.defaultType = defaultProps.type;
...@@ -2949,6 +2948,7 @@ COperator.prototype.draw = function(x, y, pGraphics) ...@@ -2949,6 +2948,7 @@ COperator.prototype.draw = function(x, y, pGraphics)
rPrp.Merge(defaultRPrp); rPrp.Merge(defaultRPrp);
rPrp.Merge(ctrPrp); rPrp.Merge(ctrPrp);
rPrp.Italic = false; rPrp.Italic = false;
rPrp.Bold = false;
pGraphics.SetFont(rPrp); pGraphics.SetFont(rPrp);
//////////////////////////////////////////////// ////////////////////////////////////////////////
...@@ -3037,7 +3037,14 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch) ...@@ -3037,7 +3037,14 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch)
} }
else else
{ {
var StretchLng = (this.type == OPER_DELIMITER || this.type == OPER_SEPARATOR) && this.grow == false ? 0 : stretch;
var StretchLng = stretch;
var bNotStretchDelim = (this.type == OPER_DELIMITER || this.type == OPER_SEPARATOR) && this.grow == false,
bNotStretchAccent = this.type == OPER_ACCENT && this.typeOper == ACCENT_TILDE;
var StretchLng = bNotStretchDelim || bNotStretchAccent ? 0 : stretch;
this.operator.fixSize(StretchLng); this.operator.fixSize(StretchLng);
dims = this.operator.getCoordinateGlyph(); dims = this.operator.getCoordinateGlyph();
this.coordGlyph = {XX: dims.XX, YY: dims.YY}; this.coordGlyph = {XX: dims.XX, YY: dims.YY};
......
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