File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -103,14 +103,16 @@ udieresis yacute thorn ydieresis\
103103` . split ( / \s + / ) ;
104104
105105class AFMFont {
106+ /**
107+ * @param {string } contents
108+ */
106109 constructor ( contents ) {
107- this . contents = contents ;
108110 this . attributes = { } ;
109111 this . glyphWidths = { } ;
110112 this . boundingBoxes = { } ;
111113 this . kernPairs = { } ;
112114
113- this . parse ( ) ;
115+ this . parse ( contents ) ;
114116
115117 this . bbox = this . attributes [ 'FontBBox' ] . split ( / \s + / ) . map ( ( e ) => + e ) ;
116118 this . ascender = + ( this . attributes [ 'Ascender' ] || 0 ) ;
@@ -121,9 +123,12 @@ class AFMFont {
121123 this . bbox [ 3 ] - this . bbox [ 1 ] - ( this . ascender - this . descender ) ;
122124 }
123125
124- parse ( ) {
126+ /**
127+ * @param {string } contents
128+ */
129+ parse ( contents ) {
125130 let section = '' ;
126- for ( let line of this . contents . split ( '\n' ) ) {
131+ for ( let line of contents . split ( '\n' ) ) {
127132 var match ;
128133 var a ;
129134 if ( ( match = line . match ( / ^ S t a r t ( \w + ) / ) ) ) {
@@ -168,6 +173,10 @@ class AFMFont {
168173 }
169174 }
170175
176+ /**
177+ * @param {string } text
178+ * @returns
179+ */
171180 encodeText ( text ) {
172181 const res = [ ] ;
173182 for ( let i = 0 , len = text . length ; i < len ; i ++ ) {
You can’t perform that action at this time.
0 commit comments