File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import {StyleList} from '../../util/StyleList.js';
3333export interface CharOptions {
3434 ic ?: number ; // italic correction value
3535 sk ?: number ; // skew value
36+ dx ?: number ; // offset for combining characters
3637 unknown ?: boolean ; // true if not found in the given variant
3738 smp ?: number ; // Math Alphanumeric codepoint this char is mapped to
3839}
Original file line number Diff line number Diff line change @@ -375,11 +375,14 @@ export class CommonWrapper<
375375 */
376376 protected copySkewIC ( bbox : BBox ) {
377377 const first = this . childNodes [ 0 ] ;
378- if ( first && first . bbox . sk ) {
378+ if ( first ? .bbox . sk ) {
379379 bbox . sk = first . bbox . sk ;
380380 }
381+ if ( first ?. bbox . dx ) {
382+ bbox . dx = first . bbox . dx ;
383+ }
381384 const last = this . childNodes [ this . childNodes . length - 1 ] ;
382- if ( last && last . bbox . ic ) {
385+ if ( last ? .bbox . ic ) {
383386 bbox . ic = last . bbox . ic ;
384387 bbox . w += bbox . ic ;
385388 }
Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ export function CommonTextNodeMixin<T extends WrapperConstructor>(Base: T): Text
9393 if ( d > bbox . d ) bbox . d = d ;
9494 bbox . ic = data . ic || 0 ;
9595 bbox . sk = data . sk || 0 ;
96+ bbox . dx = data . dx || 0 ;
9697 }
9798 if ( chars . length > 1 ) {
9899 bbox . sk = 0 ;
Original file line number Diff line number Diff line change @@ -635,7 +635,7 @@ export function CommonScriptbaseMixin<
635635 const widths = boxes . map ( box => box . w * box . rscale ) ;
636636 widths [ 0 ] -= ( this . baseRemoveIc && ! this . baseCore . node . attributes . get ( 'largeop' ) ? this . baseIc : 0 ) ;
637637 const w = Math . max ( ...widths ) ;
638- const dw = [ ] ;
638+ const dw = [ ] as number [ ] ;
639639 let m = 0 ;
640640 for ( const i of widths . keys ( ) ) {
641641 dw [ i ] = ( align === 'center' ? ( w - widths [ i ] ) / 2 :
@@ -649,6 +649,7 @@ export function CommonScriptbaseMixin<
649649 dw [ i ] += m ;
650650 }
651651 }
652+ [ 1 , 2 ] . map ( i => dw [ i ] += ( boxes [ i ] ? boxes [ i ] . dx * boxes [ 0 ] . scale : 0 ) ) ;
652653 return dw ;
653654 }
654655
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ export class BBox {
7171 public pwidth : string ; // percentage width (for tables)
7272 public ic : number ; // italic correction
7373 public sk : number ; // skew
74+ public dx : number ; // offset for combining characters as accents
7475 /* tslint:enable */
7576
7677 /**
@@ -96,7 +97,7 @@ export class BBox {
9697 this . w = def . w || 0 ;
9798 this . h = ( 'h' in def ? def . h : - BIGDIMEN ) ;
9899 this . d = ( 'd' in def ? def . d : - BIGDIMEN ) ;
99- this . L = this . R = this . ic = this . sk = 0 ;
100+ this . L = this . R = this . ic = this . sk = this . dx = 0 ;
100101 this . scale = this . rscale = 1 ;
101102 this . pwidth = '' ;
102103 }
You can’t perform that action at this time.
0 commit comments