OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* cf2font.c */ | 3 /* cf2font.c */ |
4 /* */ | 4 /* */ |
5 /* Adobe's code for font instances (body). */ | 5 /* Adobe's code for font instances (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2007-2014 Adobe Systems Incorporated. */ | 7 /* Copyright 2007-2014 Adobe Systems Incorporated. */ |
8 /* */ | 8 /* */ |
9 /* This software, and all works of authorship, whether in source or */ | 9 /* This software, and all works of authorship, whether in source or */ |
10 /* object code form as indicated by the copyright notice(s) included */ | 10 /* object code form as indicated by the copyright notice(s) included */ |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 /* value; the test doesn't need to be precise, but must be */ | 143 /* value; the test doesn't need to be precise, but must be */ |
144 /* conservative. The clamp value (default 2333) where */ | 144 /* conservative. The clamp value (default 2333) where */ |
145 /* `darkenAmount' is zero is well below the overflow value of */ | 145 /* `darkenAmount' is zero is well below the overflow value of */ |
146 /* 32767. */ | 146 /* 32767. */ |
147 /* */ | 147 /* */ |
148 /* FT_MSB computes the integer part of the base 2 logarithm. The */ | 148 /* FT_MSB computes the integer part of the base 2 logarithm. The */ |
149 /* number of bits for the product is 1 or 2 more than the sum of */ | 149 /* number of bits for the product is 1 or 2 more than the sum of */ |
150 /* logarithms; remembering that the 16 lowest bits of the fraction */ | 150 /* logarithms; remembering that the 16 lowest bits of the fraction */ |
151 /* are dropped this is correct to within a factor of almost 4. */ | 151 /* are dropped this is correct to within a factor of almost 4. */ |
152 /* For example, 0x80.0000 * 0x80.0000 = 0x4000.0000 is 23+23 and */ | 152 /* For example, 0x80.0000 * 0x80.0000 = 0x4000.0000 is 23+23 and */ |
153 /* is flagged as possible overflow because 0xff.ffff * 0xff.ffff = */ | 153 /* is flagged as possible overflow because 0xFF.FFFF * 0xFF.FFFF = */ |
154 /* 0xffff.fe00 is also 23+23. */ | 154 /* 0xFFFF.FE00 is also 23+23. */ |
155 | 155 |
156 logBase2 = FT_MSB( (FT_UInt32)stemWidthPer1000 ) + | 156 logBase2 = FT_MSB( (FT_UInt32)stemWidthPer1000 ) + |
157 FT_MSB( (FT_UInt32)ppem ); | 157 FT_MSB( (FT_UInt32)ppem ); |
158 | 158 |
159 if ( logBase2 >= 46 ) | 159 if ( logBase2 >= 46 ) |
160 /* possible overflow */ | 160 /* possible overflow */ |
161 scaledStem = cf2_intToFixed( x4 ); | 161 scaledStem = cf2_intToFixed( x4 ); |
162 else | 162 else |
163 scaledStem = FT_MulFix( stemWidthPer1000, ppem ); | 163 scaledStem = FT_MulFix( stemWidthPer1000, ppem ); |
164 | 164 |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 *glyphWidth = advWidth; | 503 *glyphWidth = advWidth; |
504 | 504 |
505 /* free resources and collect errors from objects we've used */ | 505 /* free resources and collect errors from objects we've used */ |
506 cf2_setError( &font->error, lastError ); | 506 cf2_setError( &font->error, lastError ); |
507 | 507 |
508 return font->error; | 508 return font->error; |
509 } | 509 } |
510 | 510 |
511 | 511 |
512 /* END */ | 512 /* END */ |
OLD | NEW |