提交 c7ae397c 编写于 作者: M Mr.doob

Updated builds.

上级 576f87cb
...@@ -17423,7 +17423,6 @@ ...@@ -17423,7 +17423,6 @@
if ( index !== null ) { if ( index !== null ) {
var edges = {};
var array = index.array; var array = index.array;
for ( var i = 0, l = array.length; i < l; i += 3 ) { for ( var i = 0, l = array.length; i < l; i += 3 ) {
...@@ -34992,16 +34991,28 @@ ...@@ -34992,16 +34991,28 @@
var chars = String( text ).split( '' ); var chars = String( text ).split( '' );
var scale = size / data.resolution; var scale = size / data.resolution;
var offset = 0; var line_height = ( data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness ) * scale;
var offsetX = 0, offsetY = 0;
var paths = []; var paths = [];
for ( var i = 0; i < chars.length; i ++ ) { for ( var i = 0; i < chars.length; i ++ ) {
var ret = createPath( chars[ i ], scale, offset ); var char = chars[ i ];
offset += ret.offset;
if ( char === '\n' ) {
paths.push( ret.path ); offsetX = 0;
offsetY -= line_height;
} else {
var ret = createPath( char, scale, offsetX, offsetY );
offsetX += ret.offsetX;
paths.push( ret.path );
}
} }
...@@ -35009,7 +35020,7 @@ ...@@ -35009,7 +35020,7 @@
} }
function createPath( c, scale, offset ) { function createPath( c, scale, offsetX, offsetY ) {
var glyph = data.glyphs[ c ] || data.glyphs[ '?' ]; var glyph = data.glyphs[ c ] || data.glyphs[ '?' ];
...@@ -35032,8 +35043,8 @@ ...@@ -35032,8 +35043,8 @@
case 'm': // moveTo case 'm': // moveTo
x = outline[ i ++ ] * scale + offset; x = outline[ i ++ ] * scale + offsetX;
y = outline[ i ++ ] * scale; y = outline[ i ++ ] * scale + offsetY;
path.moveTo( x, y ); path.moveTo( x, y );
...@@ -35041,8 +35052,8 @@ ...@@ -35041,8 +35052,8 @@
case 'l': // lineTo case 'l': // lineTo
x = outline[ i ++ ] * scale + offset; x = outline[ i ++ ] * scale + offsetX;
y = outline[ i ++ ] * scale; y = outline[ i ++ ] * scale + offsetY;
path.lineTo( x, y ); path.lineTo( x, y );
...@@ -35050,10 +35061,10 @@ ...@@ -35050,10 +35061,10 @@
case 'q': // quadraticCurveTo case 'q': // quadraticCurveTo
cpx = outline[ i ++ ] * scale + offset; cpx = outline[ i ++ ] * scale + offsetX;
cpy = outline[ i ++ ] * scale; cpy = outline[ i ++ ] * scale + offsetY;
cpx1 = outline[ i ++ ] * scale + offset; cpx1 = outline[ i ++ ] * scale + offsetX;
cpy1 = outline[ i ++ ] * scale; cpy1 = outline[ i ++ ] * scale + offsetY;
path.quadraticCurveTo( cpx1, cpy1, cpx, cpy ); path.quadraticCurveTo( cpx1, cpy1, cpx, cpy );
...@@ -35078,12 +35089,12 @@ ...@@ -35078,12 +35089,12 @@
case 'b': // bezierCurveTo case 'b': // bezierCurveTo
cpx = outline[ i ++ ] * scale + offset; cpx = outline[ i ++ ] * scale + offsetX;
cpy = outline[ i ++ ] * scale; cpy = outline[ i ++ ] * scale + offsetY;
cpx1 = outline[ i ++ ] * scale + offset; cpx1 = outline[ i ++ ] * scale + offsetX;
cpy1 = outline[ i ++ ] * scale; cpy1 = outline[ i ++ ] * scale + offsetY;
cpx2 = outline[ i ++ ] * scale + offset; cpx2 = outline[ i ++ ] * scale + offsetX;
cpy2 = outline[ i ++ ] * scale; cpy2 = outline[ i ++ ] * scale + offsetY;
path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy ); path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );
...@@ -35112,7 +35123,7 @@ ...@@ -35112,7 +35123,7 @@
} }
return { offset: glyph.ha * scale, path: path }; return { offsetX: glyph.ha * scale, path: path };
} }
......
此差异已折叠。
...@@ -17417,7 +17417,6 @@ function WebGLObjects( gl, properties, info ) { ...@@ -17417,7 +17417,6 @@ function WebGLObjects( gl, properties, info ) {
if ( index !== null ) { if ( index !== null ) {
var edges = {};
var array = index.array; var array = index.array;
for ( var i = 0, l = array.length; i < l; i += 3 ) { for ( var i = 0, l = array.length; i < l; i += 3 ) {
...@@ -34986,16 +34985,28 @@ Object.assign( Font.prototype, { ...@@ -34986,16 +34985,28 @@ Object.assign( Font.prototype, {
var chars = String( text ).split( '' ); var chars = String( text ).split( '' );
var scale = size / data.resolution; var scale = size / data.resolution;
var offset = 0; var line_height = ( data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness ) * scale;
var offsetX = 0, offsetY = 0;
var paths = []; var paths = [];
for ( var i = 0; i < chars.length; i ++ ) { for ( var i = 0; i < chars.length; i ++ ) {
var ret = createPath( chars[ i ], scale, offset ); var char = chars[ i ];
offset += ret.offset;
if ( char === '\n' ) {
paths.push( ret.path ); offsetX = 0;
offsetY -= line_height;
} else {
var ret = createPath( char, scale, offsetX, offsetY );
offsetX += ret.offsetX;
paths.push( ret.path );
}
} }
...@@ -35003,7 +35014,7 @@ Object.assign( Font.prototype, { ...@@ -35003,7 +35014,7 @@ Object.assign( Font.prototype, {
} }
function createPath( c, scale, offset ) { function createPath( c, scale, offsetX, offsetY ) {
var glyph = data.glyphs[ c ] || data.glyphs[ '?' ]; var glyph = data.glyphs[ c ] || data.glyphs[ '?' ];
...@@ -35026,8 +35037,8 @@ Object.assign( Font.prototype, { ...@@ -35026,8 +35037,8 @@ Object.assign( Font.prototype, {
case 'm': // moveTo case 'm': // moveTo
x = outline[ i ++ ] * scale + offset; x = outline[ i ++ ] * scale + offsetX;
y = outline[ i ++ ] * scale; y = outline[ i ++ ] * scale + offsetY;
path.moveTo( x, y ); path.moveTo( x, y );
...@@ -35035,8 +35046,8 @@ Object.assign( Font.prototype, { ...@@ -35035,8 +35046,8 @@ Object.assign( Font.prototype, {
case 'l': // lineTo case 'l': // lineTo
x = outline[ i ++ ] * scale + offset; x = outline[ i ++ ] * scale + offsetX;
y = outline[ i ++ ] * scale; y = outline[ i ++ ] * scale + offsetY;
path.lineTo( x, y ); path.lineTo( x, y );
...@@ -35044,10 +35055,10 @@ Object.assign( Font.prototype, { ...@@ -35044,10 +35055,10 @@ Object.assign( Font.prototype, {
case 'q': // quadraticCurveTo case 'q': // quadraticCurveTo
cpx = outline[ i ++ ] * scale + offset; cpx = outline[ i ++ ] * scale + offsetX;
cpy = outline[ i ++ ] * scale; cpy = outline[ i ++ ] * scale + offsetY;
cpx1 = outline[ i ++ ] * scale + offset; cpx1 = outline[ i ++ ] * scale + offsetX;
cpy1 = outline[ i ++ ] * scale; cpy1 = outline[ i ++ ] * scale + offsetY;
path.quadraticCurveTo( cpx1, cpy1, cpx, cpy ); path.quadraticCurveTo( cpx1, cpy1, cpx, cpy );
...@@ -35072,12 +35083,12 @@ Object.assign( Font.prototype, { ...@@ -35072,12 +35083,12 @@ Object.assign( Font.prototype, {
case 'b': // bezierCurveTo case 'b': // bezierCurveTo
cpx = outline[ i ++ ] * scale + offset; cpx = outline[ i ++ ] * scale + offsetX;
cpy = outline[ i ++ ] * scale; cpy = outline[ i ++ ] * scale + offsetY;
cpx1 = outline[ i ++ ] * scale + offset; cpx1 = outline[ i ++ ] * scale + offsetX;
cpy1 = outline[ i ++ ] * scale; cpy1 = outline[ i ++ ] * scale + offsetY;
cpx2 = outline[ i ++ ] * scale + offset; cpx2 = outline[ i ++ ] * scale + offsetX;
cpy2 = outline[ i ++ ] * scale; cpy2 = outline[ i ++ ] * scale + offsetY;
path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy ); path.bezierCurveTo( cpx1, cpy1, cpx2, cpy2, cpx, cpy );
...@@ -35106,7 +35117,7 @@ Object.assign( Font.prototype, { ...@@ -35106,7 +35117,7 @@ Object.assign( Font.prototype, {
} }
return { offset: glyph.ha * scale, path: path }; return { offsetX: glyph.ha * scale, path: path };
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册