Alter fonts to make ascent=descent so that line-height:0 makes its axis along the baseline. That should simplify things (though it may make unknown characters harder to handle -- we'll see).

This commit is contained in:
Davide P. Cervone 2015-03-10 13:38:23 -04:00
parent 434606ae1f
commit 9ed49e85e4
2 changed files with 3 additions and 28 deletions

View File

@ -586,8 +586,6 @@
CHTML.FONTDATA.FONTS['MathJax_Caligraphic'] = {
directory: 'Caligraphic/Regular',
ascent: .789,
descent: .216,
skew: {
0x41: 0.194,
0x42: 0.139,
@ -659,8 +657,6 @@
CHTML.FONTDATA.FONTS['MathJax_Main-bold'] = {
directory: 'Main/Bold',
weight: 'bold',
ascent: .951,
descent: .267,
skew: {
0x131: 0.0319,
0x237: 0.0958,
@ -797,8 +793,6 @@
CHTML.FONTDATA.FONTS['MathJax_Main-italic'] = {
directory: 'Main/Italic',
style: 'italic',
ascent: .750,
descent: .250,
Ranges: [
[0xA0,0xFF,"Latin1Supplement"],
[0x300,0x36F,"CombDiacritMarks"],
@ -910,8 +904,6 @@
CHTML.FONTDATA.FONTS['MathJax_Main'] = {
directory: 'Main/Regular',
ascent: .900,
descent: .272,
skew: {
0x131: 0.0278,
0x237: 0.0833,
@ -1192,8 +1184,6 @@
CHTML.FONTDATA.FONTS['MathJax_Math-italic'] = {
directory: 'Math/Italic',
style: 'italic',
ascent: .717,
descent: .218,
skew: {
0x41: 0.139,
0x42: 0.0833,
@ -1372,8 +1362,6 @@
CHTML.FONTDATA.FONTS['MathJax_Size1'] = {
directory: 'Size1/Regular',
ascent: .850,
descent: .350,
0x20: [0,0,250,0,0], // SPACE
0x28: [850,349,458,152,422], // LEFT PARENTHESIS
0x29: [850,349,458,35,305], // RIGHT PARENTHESIS
@ -1423,8 +1411,6 @@
CHTML.FONTDATA.FONTS['MathJax_Size2'] = {
directory: 'Size2/Regular',
ascent: 1.360,
descent: .862,
0x20: [0,0,250,0,0], // SPACE
0x28: [1150,649,597,180,561], // LEFT PARENTHESIS
0x29: [1150,649,597,35,416], // RIGHT PARENTHESIS
@ -1466,8 +1452,6 @@
CHTML.FONTDATA.FONTS['MathJax_Size3'] = {
directory: 'Size3/Regular',
ascent: 1.450,
descent: .950,
0x20: [0,0,250,0,0], // SPACE
0x28: [1450,949,736,209,701], // LEFT PARENTHESIS
0x29: [1450,949,736,34,526], // RIGHT PARENTHESIS
@ -1493,8 +1477,6 @@
CHTML.FONTDATA.FONTS['MathJax_Size4'] = {
directory: 'Size4/Regular',
ascent: 1.750,
descent: 1.250,
0x20: [0,0,250,0,0], // SPACE
0x28: [1750,1249,792,237,758], // LEFT PARENTHESIS
0x29: [1750,1249,792,33,554], // RIGHT PARENTHESIS

View File

@ -34,8 +34,7 @@
var EVENT, TOUCH, HOVER; // filled in later
var SCRIPTFACTOR = Math.sqrt(1/2),
AXISHEIGHT = .25,
HFUZZ = .05, DFUZZ = 0; // adjustments to bounding box of character boxes
AXISHEIGHT = .25;
var STYLES = {
".MathJax_CHTML_Display": {
@ -558,14 +557,8 @@
}
this.addCharList(node.firstChild,list,bbox);
this.cleanBBox(bbox);
bbox.h += HFUZZ; bbox.d += DFUZZ;
bbox.t += HFUZZ; bbox.b += DFUZZ;
var a = (bbox.H-bbox.D)/2; // center of font (line-height:0)
if (a < bbox.h) {node.firstChild.style.paddingTop = this.Em(bbox.h-a)}
else {node.firstChild.style.marginTop = this.Em(bbox.h-a)}
// ### FIXME: Safari doesn't center, so clip bbox.d at 0 and adjust later?
if (bbox.d+1 > 0) {node.firstChild.style.paddingBottom = this.Em(bbox.d+a)}
else {node.firstChild.style.marginBottom = this.Em(bbox.d+a)}
node.firstChild.style.paddingTop = this.Em(bbox.h);
node.firstChild.style.paddingBottom = this.Em(bbox.d);
return bbox;
},