w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

afloader.c
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * afloader.c
4  *
5  * Auto-fitter glyph loading routines (body).
6  *
7  * Copyright (C) 2003-2020 by
8  * David Turner, Robert Wilhelm, and Werner Lemberg.
9  *
10  * This file is part of the FreeType project, and may only be used,
11  * modified, and distributed under the terms of the FreeType project
12  * license, LICENSE.TXT. By continuing to use, modify, or distribute
13  * this file you indicate that you have read the license and
14  * understand and accept it fully.
15  *
16  */
17 
18 
19 #include "afglobal.h"
20 #include "afloader.h"
21 #include "afhints.h"
22 #include "aferrors.h"
23 #include "afmodule.h"
24 
25 #include <freetype/internal/ftcalc.h>
26 
27 
28  /* Initialize glyph loader. */
29 
30  FT_LOCAL_DEF( void )
33  {
34  FT_ZERO( loader );
35 
36  loader->hints = hints;
37  }
38 
39 
40  /* Reset glyph loader and compute globals if necessary. */
41 
45  FT_Face face )
46  {
48 
49 
50  loader->face = face;
51  loader->globals = (AF_FaceGlobals)face->autohint.data;
52 
53  if ( !loader->globals )
54  {
55  error = af_face_globals_new( face, &loader->globals, module );
56  if ( !error )
57  {
58  face->autohint.data =
59  (FT_Pointer)loader->globals;
62  }
63  }
64 
65  return error;
66  }
67 
68 
69  /* Finalize glyph loader. */
70 
71  FT_LOCAL_DEF( void )
73  {
74  loader->face = NULL;
75  loader->globals = NULL;
76  loader->hints = NULL;
77  }
78 
79 
80 #define af_intToFixed( i ) \
81  ( (FT_Fixed)( (FT_UInt32)(i) << 16 ) )
82 #define af_fixedToInt( x ) \
83  ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
84 #define af_floatToFixed( f ) \
85  ( (FT_Fixed)( (f) * 65536.0 + 0.5 ) )
86 
87 
88  static FT_Error
90  FT_Face face,
91  AF_StyleMetrics style_metrics )
92  {
94 
96  AF_FaceGlobals globals = loader->globals;
97  AF_WritingSystemClass writing_system_class;
98 
100 
101  FT_Pos stdVW = 0;
102  FT_Pos stdHW = 0;
103 
104  FT_Bool size_changed = size_metrics->x_ppem !=
105  globals->stem_darkening_for_ppem;
106 
107  FT_Fixed em_size = af_intToFixed( face->units_per_EM );
108  FT_Fixed em_ratio = FT_DivFix( af_intToFixed( 1000 ), em_size );
109 
110  FT_Matrix scale_down_matrix = { 0x10000L, 0, 0, 0x10000L };
111 
112 
113  /* Skip stem darkening for broken fonts. */
114  if ( !face->units_per_EM )
115  {
116  error = FT_ERR( Corrupted_Font_Header );
117  goto Exit;
118  }
119 
120  /*
121  * We depend on the writing system (script analyzers) to supply
122  * standard widths for the script of the glyph we are looking at. If
123  * it can't deliver, stem darkening is disabled.
124  */
125  writing_system_class =
127 
128  if ( writing_system_class->style_metrics_getstdw )
129  writing_system_class->style_metrics_getstdw( style_metrics,
130  &stdHW,
131  &stdVW );
132  else
133  {
134  error = FT_ERR( Unimplemented_Feature );
135  goto Exit;
136  }
137 
138  if ( size_changed ||
139  ( stdVW > 0 && stdVW != globals->standard_vertical_width ) )
140  {
141  FT_Fixed darken_by_font_units_x, darken_x;
142 
143 
144  darken_by_font_units_x =
146  face,
147  stdVW ) );
148  darken_x = FT_DivFix( FT_MulFix( darken_by_font_units_x,
149  size_metrics->x_scale ),
150  em_ratio );
151 
152  globals->standard_vertical_width = stdVW;
153  globals->stem_darkening_for_ppem = size_metrics->x_ppem;
154  globals->darken_x = af_fixedToInt( darken_x );
155  }
156 
157  if ( size_changed ||
158  ( stdHW > 0 && stdHW != globals->standard_horizontal_width ) )
159  {
160  FT_Fixed darken_by_font_units_y, darken_y;
161 
162 
163  darken_by_font_units_y =
165  face,
166  stdHW ) );
167  darken_y = FT_DivFix( FT_MulFix( darken_by_font_units_y,
168  size_metrics->y_scale ),
169  em_ratio );
170 
171  globals->standard_horizontal_width = stdHW;
172  globals->stem_darkening_for_ppem = size_metrics->x_ppem;
173  globals->darken_y = af_fixedToInt( darken_y );
174 
175  /*
176  * Scale outlines down on the Y-axis to keep them inside their blue
177  * zones. The stronger the emboldening, the stronger the downscaling
178  * (plus heuristical padding to prevent outlines still falling out
179  * their zones due to rounding).
180  *
181  * Reason: `FT_Outline_Embolden' works by shifting the rightmost
182  * points of stems farther to the right, and topmost points farther
183  * up. This positions points on the Y-axis outside their
184  * pre-computed blue zones and leads to distortion when applying the
185  * hints in the code further below. Code outside this emboldening
186  * block doesn't know we are presenting it with modified outlines the
187  * analyzer didn't see!
188  *
189  * An unfortunate side effect of downscaling is that the emboldening
190  * effect is slightly decreased. The loss becomes more pronounced
191  * versus the CFF driver at smaller sizes, e.g., at 9ppem and below.
192  */
193  globals->scale_down_factor =
194  FT_DivFix( em_size - ( darken_by_font_units_y + af_intToFixed( 8 ) ),
195  em_size );
196  }
197 
198  FT_Outline_EmboldenXY( &slot->outline,
199  globals->darken_x,
200  globals->darken_y );
201 
202  scale_down_matrix.yy = globals->scale_down_factor;
203  FT_Outline_Transform( &slot->outline, &scale_down_matrix );
204 
205  Exit:
206  return error;
207  }
208 
209 
210  /* Load the glyph at index into the current slot of a face and hint it. */
211 
215  FT_Face face,
217  FT_Int32 load_flags )
218  {
219  FT_Error error;
220 
221  FT_Size size = face->size;
222  FT_Size_Internal size_internal = size->internal;
224  FT_Slot_Internal slot_internal = slot->internal;
225  FT_GlyphLoader gloader = slot_internal->loader;
226 
227  AF_GlyphHints hints = loader->hints;
228  AF_ScalerRec scaler;
229  AF_StyleMetrics style_metrics;
230  FT_UInt style_options = AF_STYLE_NONE_DFLT;
231  AF_StyleClass style_class;
232  AF_WritingSystemClass writing_system_class;
233 
234 
235  if ( !size )
236  return FT_THROW( Invalid_Size_Handle );
237 
238  FT_ZERO( &scaler );
239 
240  if ( !size_internal->autohint_metrics.x_scale ||
241  size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) )
242  {
243  /* switching between hinting modes usually means different scaling */
244  /* values; this later on enforces recomputation of everything */
245  /* related to the current size */
246 
247  size_internal->autohint_mode = FT_LOAD_TARGET_MODE( load_flags );
248  size_internal->autohint_metrics = size->metrics;
249 
250 #ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS
251  {
252  FT_Size_Metrics* size_metrics = &size_internal->autohint_metrics;
253 
254 
255  /* set metrics to integer values and adjust scaling accordingly; */
256  /* this is the same setup as with TrueType fonts, cf. function */
257  /* `tt_size_reset' in file `ttobjs.c' */
258  size_metrics->ascender = FT_PIX_ROUND(
260  size_metrics->y_scale ) );
261  size_metrics->descender = FT_PIX_ROUND(
263  size_metrics->y_scale ) );
264  size_metrics->height = FT_PIX_ROUND(
266  size_metrics->y_scale ) );
267 
268  size_metrics->x_scale = FT_DivFix( size_metrics->x_ppem << 6,
269  face->units_per_EM );
270  size_metrics->y_scale = FT_DivFix( size_metrics->y_ppem << 6,
271  face->units_per_EM );
272  size_metrics->max_advance = FT_PIX_ROUND(
274  size_metrics->x_scale ) );
275  }
276 #endif /* AF_CONFIG_OPTION_TT_SIZE_METRICS */
277  }
278 
279  /*
280  * TODO: This code currently doesn't support fractional advance widths,
281  * i.e., placing hinted glyphs at anything other than integer
282  * x-positions. This is only relevant for the warper code, which
283  * scales and shifts glyphs to optimize blackness of stems (hinting on
284  * the x-axis by nature places things on pixel integers, hinting on the
285  * y-axis only, i.e., LIGHT mode, doesn't touch the x-axis). The delta
286  * values of the scaler would need to be adjusted.
287  */
288  scaler.face = face;
289  scaler.x_scale = size_internal->autohint_metrics.x_scale;
290  scaler.x_delta = 0;
291  scaler.y_scale = size_internal->autohint_metrics.y_scale;
292  scaler.y_delta = 0;
293 
294  scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );
295  scaler.flags = 0;
296 
297  /* note that the fallback style can't be changed anymore */
298  /* after the first call of `af_loader_load_glyph' */
299  error = af_loader_reset( loader, module, face );
300  if ( error )
301  goto Exit;
302 
303 #ifdef FT_OPTION_AUTOFIT2
304  /* XXX: undocumented hook to activate the latin2 writing system. */
305  if ( load_flags & ( 1UL << 20 ) )
306  style_options = AF_STYLE_LTN2_DFLT;
307 #endif
308 
309  /*
310  * Glyphs (really code points) are assigned to scripts. Script
311  * analysis is done lazily: For each glyph that passes through here,
312  * the corresponding script analyzer is called, but returns immediately
313  * if it has been run already.
314  */
315  error = af_face_globals_get_metrics( loader->globals, glyph_index,
316  style_options, &style_metrics );
317  if ( error )
318  goto Exit;
319 
320  style_class = style_metrics->style_class;
321  writing_system_class =
323 
324  loader->metrics = style_metrics;
325 
326  if ( writing_system_class->style_metrics_scale )
327  writing_system_class->style_metrics_scale( style_metrics, &scaler );
328  else
329  style_metrics->scaler = scaler;
330 
331  if ( writing_system_class->style_hints_init )
332  {
333  error = writing_system_class->style_hints_init( hints,
334  style_metrics );
335  if ( error )
336  goto Exit;
337  }
338 
339  /*
340  * Do the main work of `af_loader_load_glyph'. Note that we never have
341  * to deal with composite glyphs as those get loaded into
342  * FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function.
343  * In the rare cases where FT_LOAD_NO_RECURSE is set, it implies
344  * FT_LOAD_NO_SCALE and as such the auto-hinter is never called.
345  */
346  load_flags |= FT_LOAD_NO_SCALE |
349  load_flags &= ~~FT_LOAD_RENDER;
350 
351  error = FT_Load_Glyph( face, glyph_index, load_flags );
352  if ( error )
353  goto Exit;
354 
355  /*
356  * Apply stem darkening (emboldening) here before hints are applied to
357  * the outline. Glyphs are scaled down proportionally to the
358  * emboldening so that curve points don't fall outside their
359  * precomputed blue zones.
360  *
361  * Any emboldening done by the font driver (e.g., the CFF driver)
362  * doesn't reach here because the autohinter loads the unprocessed
363  * glyphs in font units for analysis (functions `af_*_metrics_init_*')
364  * and then above to prepare it for the rasterizers by itself,
365  * independently of the font driver. So emboldening must be done here,
366  * within the autohinter.
367  *
368  * All glyphs to be autohinted pass through here one by one. The
369  * standard widths can therefore change from one glyph to the next,
370  * depending on what script a glyph is assigned to (each script has its
371  * own set of standard widths and other metrics). The darkening amount
372  * must therefore be recomputed for each size and
373  * `standard_{vertical,horizontal}_width' change.
374  *
375  * Ignore errors and carry on without emboldening.
376  *
377  */
378 
379  /* stem darkening only works well in `light' mode */
380  if ( scaler.render_mode == FT_RENDER_MODE_LIGHT &&
382  ( face->internal->no_stem_darkening < 0 &&
383  !module->no_stem_darkening ) ) )
384  af_loader_embolden_glyph_in_slot( loader, face, style_metrics );
385 
386  loader->transformed = slot_internal->glyph_transformed;
387  if ( loader->transformed )
388  {
389  FT_Matrix inverse;
390 
391 
392  loader->trans_matrix = slot_internal->glyph_matrix;
393  loader->trans_delta = slot_internal->glyph_delta;
394 
395  inverse = loader->trans_matrix;
396  if ( !FT_Matrix_Invert( &inverse ) )
397  FT_Vector_Transform( &loader->trans_delta, &inverse );
398  }
399 
400  switch ( slot->format )
401  {
403  /* translate the loaded glyph when an internal transform is needed */
404  if ( loader->transformed )
405  FT_Outline_Translate( &slot->outline,
406  loader->trans_delta.x,
407  loader->trans_delta.y );
408 
409  /* compute original horizontal phantom points */
410  /* (and ignore vertical ones) */
411  loader->pp1.x = hints->x_delta;
412  loader->pp1.y = hints->y_delta;
413  loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance,
414  hints->x_scale ) + hints->x_delta;
415  loader->pp2.y = hints->y_delta;
416 
417  /* be sure to check for spacing glyphs */
418  if ( slot->outline.n_points == 0 )
419  goto Hint_Metrics;
420 
421  /* now load the slot image into the auto-outline */
422  /* and run the automatic hinting process */
423  if ( writing_system_class->style_hints_apply )
424  {
425  error = writing_system_class->style_hints_apply(
426  glyph_index,
427  hints,
428  &gloader->base.outline,
429  style_metrics );
430  if ( error )
431  goto Exit;
432  }
433 
434  /* we now need to adjust the metrics according to the change in */
435  /* width/positioning that occurred during the hinting process */
436  if ( scaler.render_mode != FT_RENDER_MODE_LIGHT )
437  {
438  AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ];
439 
440 
441  if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )
442  {
443  AF_Edge edge1 = axis->edges; /* leftmost edge */
444  AF_Edge edge2 = edge1 +
445  axis->num_edges - 1; /* rightmost edge */
446 
447  FT_Pos old_rsb = loader->pp2.x - edge2->opos;
448  /* loader->pp1.x is always zero at this point of time */
449  FT_Pos old_lsb = edge1->opos; /* - loader->pp1.x */
450  FT_Pos new_lsb = edge1->pos;
451 
452  /* remember unhinted values to later account */
453  /* for rounding errors */
454  FT_Pos pp1x_uh = new_lsb - old_lsb;
455  FT_Pos pp2x_uh = edge2->pos + old_rsb;
456 
457 
458  /* prefer too much space over too little space */
459  /* for very small sizes */
460 
461  if ( old_lsb < 24 )
462  pp1x_uh -= 8;
463 
464  if ( old_rsb < 24 )
465  pp2x_uh += 8;
466 
467  loader->pp1.x = FT_PIX_ROUND( pp1x_uh );
468  loader->pp2.x = FT_PIX_ROUND( pp2x_uh );
469 
470  if ( loader->pp1.x >= new_lsb && old_lsb > 0 )
471  loader->pp1.x -= 64;
472 
473  if ( loader->pp2.x <= edge2->pos && old_rsb > 0 )
474  loader->pp2.x += 64;
475 
476  slot->lsb_delta = loader->pp1.x - pp1x_uh;
477  slot->rsb_delta = loader->pp2.x - pp2x_uh;
478  }
479  else
480  {
481  FT_Pos pp1x = loader->pp1.x;
482  FT_Pos pp2x = loader->pp2.x;
483 
484 
485  loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
486  loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta );
487 
488  slot->lsb_delta = loader->pp1.x - pp1x;
489  slot->rsb_delta = loader->pp2.x - pp2x;
490  }
491  }
492  /* `light' mode uses integer advance widths */
493  /* but sets `lsb_delta' and `rsb_delta' */
494  else
495  {
496  FT_Pos pp1x = loader->pp1.x;
497  FT_Pos pp2x = loader->pp2.x;
498 
499 
500  loader->pp1.x = FT_PIX_ROUND( pp1x );
501  loader->pp2.x = FT_PIX_ROUND( pp2x );
502 
503  slot->lsb_delta = loader->pp1.x - pp1x;
504  slot->rsb_delta = loader->pp2.x - pp2x;
505  }
506 
507  break;
508 
509  default:
510  /* we don't support other formats (yet?) */
511  error = FT_THROW( Unimplemented_Feature );
512  }
513 
514  Hint_Metrics:
515  {
516  FT_BBox bbox;
517  FT_Vector vvector;
518 
519 
520  vvector.x = slot->metrics.vertBearingX - slot->metrics.horiBearingX;
521  vvector.y = slot->metrics.vertBearingY - slot->metrics.horiBearingY;
522  vvector.x = FT_MulFix( vvector.x, style_metrics->scaler.x_scale );
523  vvector.y = FT_MulFix( vvector.y, style_metrics->scaler.y_scale );
524 
525  /* transform the hinted outline if needed */
526  if ( loader->transformed )
527  {
528  FT_Outline_Transform( &gloader->base.outline, &loader->trans_matrix );
529  FT_Vector_Transform( &vvector, &loader->trans_matrix );
530  }
531 
532  /* we must translate our final outline by -pp1.x and compute */
533  /* the new metrics */
534  if ( loader->pp1.x )
535  FT_Outline_Translate( &gloader->base.outline, -loader->pp1.x, 0 );
536 
537  FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
538 
539  bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
540  bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
541  bbox.xMax = FT_PIX_CEIL( bbox.xMax );
542  bbox.yMax = FT_PIX_CEIL( bbox.yMax );
543 
544  slot->metrics.width = bbox.xMax - bbox.xMin;
545  slot->metrics.height = bbox.yMax - bbox.yMin;
546  slot->metrics.horiBearingX = bbox.xMin;
547  slot->metrics.horiBearingY = bbox.yMax;
548 
549  slot->metrics.vertBearingX = FT_PIX_FLOOR( bbox.xMin + vvector.x );
550  slot->metrics.vertBearingY = FT_PIX_FLOOR( bbox.yMax + vvector.y );
551 
552  /* for mono-width fonts (like Andale, Courier, etc.) we need */
553  /* to keep the original rounded advance width; ditto for */
554  /* digits if all have the same advance width */
555  if ( scaler.render_mode != FT_RENDER_MODE_LIGHT &&
556  ( FT_IS_FIXED_WIDTH( slot->face ) ||
557  ( af_face_globals_is_digit( loader->globals, glyph_index ) &&
558  style_metrics->digits_have_same_width ) ) )
559  {
560  slot->metrics.horiAdvance =
561  FT_MulFix( slot->metrics.horiAdvance,
562  style_metrics->scaler.x_scale );
563 
564  /* Set delta values to 0. Otherwise code that uses them is */
565  /* going to ruin the fixed advance width. */
566  slot->lsb_delta = 0;
567  slot->rsb_delta = 0;
568  }
569  else
570  {
571  /* non-spacing glyphs must stay as-is */
572  if ( slot->metrics.horiAdvance )
573  slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
574  }
575 
576  slot->metrics.vertAdvance = FT_MulFix( slot->metrics.vertAdvance,
577  style_metrics->scaler.y_scale );
578 
579  slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
580  slot->metrics.vertAdvance = FT_PIX_ROUND( slot->metrics.vertAdvance );
581 
582  slot->format = FT_GLYPH_FORMAT_OUTLINE;
583  }
584 
585  Exit:
586  return error;
587  }
588 
589 
590  /*
591  * Compute amount of font units the face should be emboldened by, in
592  * analogy to the CFF driver's `cf2_computeDarkening' function. See there
593  * for details of the algorithm.
594  *
595  * XXX: Currently a crude adaption of the original algorithm. Do better?
596  */
597  FT_LOCAL_DEF( FT_Int32 )
599  FT_Face face,
601  {
602  AF_Module module = loader->globals->module;
603 
604  FT_UShort units_per_EM;
605  FT_Fixed ppem, em_ratio;
606  FT_Fixed stem_width, stem_width_per_1000, scaled_stem, darken_amount;
607  FT_Int log_base_2;
608  FT_Int x1, y1, x2, y2, x3, y3, x4, y4;
609 
610 
611  ppem = FT_MAX( af_intToFixed( 4 ),
613  units_per_EM = face->units_per_EM;
614 
615  em_ratio = FT_DivFix( af_intToFixed( 1000 ),
616  af_intToFixed ( units_per_EM ) );
617  if ( em_ratio < af_floatToFixed( .01 ) )
618  {
619  /* If something goes wrong, don't embolden. */
620  return 0;
621  }
622 
623  x1 = module->darken_params[0];
624  y1 = module->darken_params[1];
625  x2 = module->darken_params[2];
626  y2 = module->darken_params[3];
627  x3 = module->darken_params[4];
628  y3 = module->darken_params[5];
629  x4 = module->darken_params[6];
630  y4 = module->darken_params[7];
631 
632  if ( standard_width <= 0 )
633  {
634  stem_width = af_intToFixed( 75 ); /* taken from cf2font.c */
635  stem_width_per_1000 = stem_width;
636  }
637  else
638  {
639  stem_width = af_intToFixed( standard_width );
640  stem_width_per_1000 = FT_MulFix( stem_width, em_ratio );
641  }
642 
643  log_base_2 = FT_MSB( (FT_UInt32)stem_width_per_1000 ) +
644  FT_MSB( (FT_UInt32)ppem );
645 
646  if ( log_base_2 >= 46 )
647  {
648  /* possible overflow */
649  scaled_stem = af_intToFixed( x4 );
650  }
651  else
652  scaled_stem = FT_MulFix( stem_width_per_1000, ppem );
653 
654  /* now apply the darkening parameters */
655  if ( scaled_stem < af_intToFixed( x1 ) )
656  darken_amount = FT_DivFix( af_intToFixed( y1 ), ppem );
657 
658  else if ( scaled_stem < af_intToFixed( x2 ) )
659  {
660  FT_Int xdelta = x2 - x1;
661  FT_Int ydelta = y2 - y1;
662  FT_Int x = stem_width_per_1000 -
664 
665 
666  if ( !xdelta )
667  goto Try_x3;
668 
669  darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
671  }
672 
673  else if ( scaled_stem < af_intToFixed( x3 ) )
674  {
675  Try_x3:
676  {
677  FT_Int xdelta = x3 - x2;
678  FT_Int ydelta = y3 - y2;
679  FT_Int x = stem_width_per_1000 -
681 
682 
683  if ( !xdelta )
684  goto Try_x4;
685 
686  darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
688  }
689  }
690 
691  else if ( scaled_stem < af_intToFixed( x4 ) )
692  {
693  Try_x4:
694  {
695  FT_Int xdelta = x4 - x3;
696  FT_Int ydelta = y4 - y3;
697  FT_Int x = stem_width_per_1000 -
699 
700 
701  if ( !xdelta )
702  goto Use_y4;
703 
704  darken_amount = FT_MulDiv( x, ydelta, xdelta ) +
706  }
707  }
708 
709  else
710  {
711  Use_y4:
712  darken_amount = FT_DivFix( af_intToFixed( y4 ), ppem );
713  }
714 
715  /* Convert darken_amount from per 1000 em to true character space. */
716  return af_fixedToInt( FT_DivFix( darken_amount, em_ratio ) );
717  }
718 
719 
720 /* END */
#define x3
#define y4
#define x4
#define y3
#define error(a)
Definition: dviinfo.c:48
void Exit(int code)
Definition: dvispc.c:374
FT_Load_Glyph(FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: ftobjs.c:796
#define FT_LOAD_TARGET_MODE(x)
Definition: freetype.h:3154
#define FT_LOAD_IGNORE_TRANSFORM
Definition: freetype.h:3032
#define FT_LOAD_NO_SCALE
Definition: freetype.h:3022
FT_DivFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:607
#define FT_IS_FIXED_WIDTH(face)
Definition: freetype.h:1305
FT_Vector_Transform(FT_Vector *vector, const FT_Matrix *matrix)
Definition: ftoutln.c:683
@ FT_RENDER_MODE_LIGHT
Definition: freetype.h:3250
#define FT_LOAD_LINEAR_DESIGN
Definition: freetype.h:3034
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
Definition: ftcalc.c:415
FT_MulFix(FT_Long a, FT_Long b)
Definition: ftcalc.c:508
FT_Matrix_Invert(FT_Matrix *matrix)
Definition: ftcalc.c:688
@ FT_GLYPH_FORMAT_OUTLINE
Definition: ftimage.h:749
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
FT_Outline_EmboldenXY(FT_Outline *outline, FT_Pos xstrength, FT_Pos ystrength)
Definition: ftoutln.c:904
FT_Outline_Translate(const FT_Outline *outline, FT_Pos xOffset, FT_Pos yOffset)
Definition: ftoutln.c:507
FT_Outline_Transform(const FT_Outline *outline, const FT_Matrix *matrix)
Definition: ftoutln.c:706
FT_Outline_Get_CBox(const FT_Outline *outline, FT_BBox *acbox)
Definition: ftoutln.c:457
void * FT_Pointer
Definition: fttypes.h:310
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
signed long FT_Fixed
Definition: fttypes.h:287
int FT_Error
Definition: fttypes.h:299
#define FT_ERR(e)
Definition: fttypes.h:599
unsigned short FT_UShort
Definition: fttypes.h:209
void(* FT_Generic_Finalizer)(void *object)
Definition: fttypes.h:435
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
#define FT_LOCAL_DEF(x)
FT_Int FT_MSB(FT_UInt32 z)
Definition: ftcalc.c:113
#define FT_THROW(e)
Definition: ftdebug.h:243
#define FT_ZERO(p)
Definition: ftmemory.h:246
#define FT_PIX_CEIL(x)
Definition: ftobjs.h:93
#define NULL
Definition: ftobjs.h:61
#define FT_PIX_FLOOR(x)
Definition: ftobjs.h:91
#define FT_PIX_ROUND(x)
Definition: ftobjs.h:92
#define FT_MAX(a, b)
Definition: ftobjs.h:71
af_face_globals_is_digit(AF_FaceGlobals globals, FT_UInt gindex)
Definition: afglobal.c:499
af_face_globals_new(FT_Face face, AF_FaceGlobals *aglobals, AF_Module module)
Definition: afglobal.c:331
af_face_globals_free(AF_FaceGlobals globals)
Definition: afglobal.c:382
af_face_globals_get_metrics(AF_FaceGlobals globals, FT_UInt gindex, FT_UInt options, AF_StyleMetrics *ametrics)
Definition: afglobal.c:420
af_writing_system_classes[]
Definition: afglobal.c:74
@ AF_DIMENSION_HORZ
Definition: afhints.h:35
#define AF_HINTS_DO_ADVANCE(h)
Definition: afhints.h:408
af_loader_init(AF_Loader loader, AF_GlyphHints hints)
Definition: afloader.c:31
af_loader_compute_darkening(AF_Loader loader, FT_Face face, FT_Pos standard_width)
Definition: afloader.c:598
af_loader_load_glyph(AF_Loader loader, AF_Module module, FT_Face face, FT_UInt glyph_index, FT_Int32 load_flags)
Definition: afloader.c:213
af_loader_reset(AF_Loader loader, AF_Module module, FT_Face face)
Definition: afloader.c:43
af_loader_done(AF_Loader loader)
Definition: afloader.c:72
FT_BEGIN_HEADER struct AF_LoaderRec_ * AF_Loader
FT_BEGIN_HEADER struct AF_ModuleRec_ * AF_Module
struct AF_FaceGlobalsRec_ * AF_FaceGlobals
Definition: aftypes.h:468
return FT_Err_Ok
Definition: ftbbox.c:526
FT_BBox bbox
Definition: ftbbox.c:467
FT_Face face
Definition: cffdrivr.c:659
T1_FIELD_DICT_PRIVATE T1_FIELD_DICT_PRIVATE T1_FIELD_DICT_PRIVATE T1_FIELD_DICT_PRIVATE T1_FIELD_DICT_PRIVATE standard_width
Definition: t1tokens.h:83
float x
Definition: cordic.py:15
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld if[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1(dst_w_bpp<=(lowbit *8)) &&((lowbit *8)<(pixblock_size *dst_w_bpp)) .if lowbit< 16 tst DST_R
static int size
Definition: ppmlabel.c:24
#define x1
#define y1
#define y2
#define x2
#define af_fixedToInt(x)
Definition: afloader.c:82
#define af_floatToFixed(f)
Definition: afloader.c:84
#define af_intToFixed(i)
Definition: afloader.c:80
static FT_Error af_loader_embolden_glyph_in_slot(AF_Loader loader, FT_Face face, AF_StyleMetrics style_metrics)
Definition: afloader.c:89
slotref slot
Definition: opcodes.h:237
#define glyph_index()
FT_Int num_edges
Definition: afhints.h:320
AF_Edge edges
Definition: afhints.h:322
FT_Pos pos
Definition: afhints.h:292
FT_Pos opos
Definition: afhints.h:291
FT_UShort stem_darkening_for_ppem
Definition: afglobal.h:123
FT_Pos standard_horizontal_width
Definition: afglobal.h:129
FT_Pos standard_vertical_width
Definition: afglobal.h:126
FT_Fixed scale_down_factor
Definition: afglobal.h:136
FT_UInt32 flags
Definition: aftypes.h:186
FT_Render_Mode render_mode
Definition: aftypes.h:185
FT_Pos y_delta
Definition: aftypes.h:184
FT_Face face
Definition: aftypes.h:180
FT_Pos x_delta
Definition: aftypes.h:183
FT_Fixed y_scale
Definition: aftypes.h:182
FT_Fixed x_scale
Definition: aftypes.h:181
AF_WritingSystem writing_system
Definition: aftypes.h:450
AF_ScalerRec scaler
Definition: aftypes.h:477
FT_Bool digits_have_same_width
Definition: aftypes.h:478
AF_StyleClass style_class
Definition: aftypes.h:476
AF_WritingSystem_InitHintsFunc style_hints_init
Definition: aftypes.h:287
AF_WritingSystem_GetStdWidthsFunc style_metrics_getstdw
Definition: aftypes.h:285
AF_WritingSystem_ScaleMetricsFunc style_metrics_scale
Definition: aftypes.h:283
AF_WritingSystem_ApplyHintsFunc style_hints_apply
Definition: aftypes.h:288
FT_Size size
Definition: freetype.h:1066
FT_Generic autohint
Definition: freetype.h:1077
FT_Short height
Definition: freetype.h:1057
FT_Short descender
Definition: freetype.h:1056
FT_UShort units_per_EM
Definition: freetype.h:1054
FT_Short max_advance_width
Definition: freetype.h:1059
FT_GlyphSlot glyph
Definition: freetype.h:1065
FT_Face_Internal internal
Definition: freetype.h:1080
FT_Short ascender
Definition: freetype.h:1055
FT_Char no_stem_darkening
Definition: ftobjs.h:369
FT_Generic_Finalizer finalizer
Definition: fttypes.h:470
void * data
Definition: fttypes.h:469
FT_Outline outline
Definition: ftgloadr.h:51
FT_GlyphLoadRec base
Definition: ftgloadr.h:68
FT_Fixed yy
Definition: fttypes.h:393
FT_Size_Internal internal
Definition: freetype.h:1637
FT_Size_Metrics metrics
Definition: freetype.h:1636
FT_Size_Metrics autohint_metrics
Definition: ftobjs.h:462
FT_Render_Mode autohint_mode
Definition: ftobjs.h:461
FT_Fixed y_scale
Definition: freetype.h:1601
FT_Fixed x_scale
Definition: freetype.h:1600
FT_Pos descender
Definition: freetype.h:1604
FT_UShort x_ppem
Definition: freetype.h:1597
FT_UShort y_ppem
Definition: freetype.h:1598
FT_Pos max_advance
Definition: freetype.h:1606
FT_Vector glyph_delta
Definition: ftobjs.h:429
FT_Matrix glyph_matrix
Definition: ftobjs.h:428
FT_Bool glyph_transformed
Definition: ftobjs.h:427
FT_GlyphLoader loader
Definition: ftobjs.h:425
FT_Pos x
Definition: ftimage.h:77
FT_Pos y
Definition: ftimage.h:78
Definition: obx.h:117
Definition: nsfix.c:44
Definition: edgelist.h:31
int hints
Definition: ttf2pt1.c:133
int ppem
Definition: ttflib.c:39