formatting, improving documentation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798
diff --git a/ChangeLog b/ChangeLog
index d436f20..6ba1c97 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,37 +5,48 @@
2006-09-28 David Turner <david@freetype.org>
- * include/freetype/internal/ftobjs.h, src/truetype/ttobjs.c,
- src/base/ftobjs.c: fixed a bug in the automatic unpatented
- hinting support which prevented normal bytecode hinting to
- work properly
+ Fix a bug in the automatic unpatented hinting support which prevents
+ normal bytecode hinting to work properly.
- * src/autofit/aftypes.h: undefining AF_DEBUG to get rid of
- traces
+ * include/freetype/internal/ftobjs.h (FT_Face_InternalRec):
+ s/force_autohint/unpatented_hinting/. Update all callers.
+
+ * src/base/ftobjs.c (FT_Load_Glyph): Updated code.
+
+ * src/autofit/aftypes.h (AF_DEBUG): Undefine to get rid of traces.
2006-09-27 David Turner <david@freetype.org>
- * include/freetype/freetype.h: bumping FT_FREETYPE_PATCH to 2
- for an upcoming 2.2.2 release
+ * include/freetype/freetype.h (FT_FREETYPE_PATCH): Set to 2.
+
+
+ Add a new API to support color filtering of subpixel glyph bitmaps.
+ In a default build, the function `FT_Library_SetLcdFilter' returns
+ `FT_Err_Unimplemented_Feature'; you need to #define
+ FT_CONFIG_OPTION_SUBPIXEL_RENDERING in ftoption.h to compile the
+ real implementation.
+
+ * include/freetype/ftlcdfil.h, src/base/ftlcdfil.c: New files.
- * include/freetype/ftlcdfil.h, src/freetype/ftlcdfil.c:
- added a new API to support color filtering of subpixel glyph
- bitmaps. In default build, the function FT_Library_SetLcdFilter
- returns FT_Err_Unimplemented_Feature; you need to #define
- FT_CONFIG_OPTION_SUBPIXEL_RENDERING in ftoption.h to compile
- the real implementation
+ * include/freetype/internal/ftobjs.h (FT_Bitmap_LcdFilterFunc): New
+ typedef.
+ (FT_LibraryRec) [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: New members
+ `lcd_filter_weights' and `lcd_filter'.
- * src/smooth/ftsmooth.c: adding support for sub-pixel color
- filtering; simplifying a few function calls
+ * src/smooth/ftsmooth.c (ft_smooth_render_generic): Remove arguments
+ `hmul' and `vmul'.
+ Handle subpixel rendering.
+ Simplify function.
+ (ft_smooth_render_lcd): Use `FT_RENDER_MODE_LCD'.
+ (ft_smooth_render_lcd_v): Use `FT_RENDER_MODE_LCD_V'.
- * include/freetype/config/ftheader.h: adding FT_LCD_FILTER_H
- macro that points to <freetype/ftlcdfil.h>
+ * include/freetype/config/ftheader.h (FT_LCD_FILTER_H): New macro,
+ pointing to <freetype/ftlcdfil.h>.
- * src/base/Jamfile, src/base/rules.mk, vms_make.com: adding
- 'ftlcdfil.c' to the list of compiled source files
+ * src/base/Jamfile (_sources), src/base/rules.mk (BASE_SRC),
+ vms_make.com: Add `ftlcdfil.c' to the list of compiled source files.
- * modules.cfg: adding ftlcdfil.c to the list of default base
- extensions
+ * modules.cfg (BASE_EXTENSIONS): Add ftlcdfil.c.
2006-09-26 David Bustin
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index 097ff66..1265191 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -88,7 +88,7 @@
/* limited to the infamous 8.3 naming rule required by DOS (and */
/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
/* */
- /* The second reason is that is allows for more flexibility in the */
+ /* The second reason is that it allows for more flexibility in the */
/* way FreeType 2 is installed on a given system. */
/* */
/*************************************************************************/
@@ -222,7 +222,7 @@
* FT_IMAGE_H
*
* @description:
- * A macro used in #include statements to name the file containing types
+ * A macro used in #include statements to name the file containing type
* definitions related to glyph images (i.e., bitmaps, outlines,
* scan-converter parameters).
*
@@ -282,7 +282,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * API used to manage multiple @FT_Size objects per face.
+ * API which manages multiple @FT_Size objects per face.
*
*/
#define FT_SIZES_H <freetype/ftsizes.h>
@@ -334,10 +334,9 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * enumeration values used to identify name strings, languages,
- * encodings, etc. This file really contains a _large_ set of constant
- * macro definitions, taken from the TrueType and OpenType
- * specifications.
+ * enumeration values which identify name strings, languages, encodings,
+ * etc. This file really contains a _large_ set of constant macro
+ * definitions, taken from the TrueType and OpenType specifications.
*
*/
#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
@@ -363,7 +362,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * definitions of TrueType four-byte `tags' used to identify blocks in
+ * definitions of TrueType four-byte `tags' which identify blocks in
* SFNT-based font formats (i.e., TrueType and OpenType).
*
*/
@@ -377,7 +376,8 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * definitions of an API to access BDF-specific strings from a face.
+ * definitions of an API which accesses BDF-specific strings from a
+ * face.
*
*/
#define FT_BDF_H <freetype/ftbdf.h>
@@ -390,7 +390,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * definitions of an API to support for gzip-compressed files.
+ * definitions of an API which supports gzip-compressed files.
*
*/
#define FT_GZIP_H <freetype/ftgzip.h>
@@ -403,7 +403,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * definitions of an API to support for LZW-compressed files.
+ * definitions of an API which supports LZW-compressed files.
*
*/
#define FT_LZW_H <freetype/ftlzw.h>
@@ -416,7 +416,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * definitions of an API to support Windows FNT files.
+ * definitions of an API which supports Windows FNT files.
*
*/
#define FT_WINFONTS_H <freetype/ftwinfnt.h>
@@ -484,7 +484,7 @@
* `glyph image' API of the FreeType 2 cache sub-system.
*
* It is used to define a cache for @FT_Glyph elements. You can also
- * see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
+ * use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
* store small glyph bitmaps, as it will use less memory.
*
* This macro is deprecated. Simply include @FT_CACHE_H to have all
@@ -568,7 +568,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * optional FreeType 2 API used to access embedded `name' strings in
+ * optional FreeType 2 API which accesses embedded `name' strings in
* SFNT-based font formats (i.e., TrueType and OpenType).
*
*/
@@ -582,7 +582,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * optional FreeType 2 API used to validate OpenType tables (BASE, GDEF,
+ * optional FreeType 2 API which validates OpenType tables (BASE, GDEF,
* GPOS, GSUB, JSTF).
*
*/
@@ -596,7 +596,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * optional FreeType 2 API used to validate TrueTypeGX/AAT tables (feat,
+ * optional FreeType 2 API which validates TrueTypeGX/AAT tables (feat,
* mort, morx, bsln, just, kern, opbd, trak, prop).
*
*/
@@ -610,7 +610,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API used to access PFR-specific data.
+ * FreeType 2 API which accesses PFR-specific data.
*
*/
#define FT_PFR_H <freetype/ftpfr.h>
@@ -623,7 +623,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API used to stroke outline path.
+ * FreeType 2 API which provides functions to stroke outline paths.
*/
#define FT_STROKER_H <freetype/ftstroke.h>
@@ -635,7 +635,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API used to perform artificial obliquing and emboldening.
+ * FreeType 2 API which performs artificial obliquing and emboldening.
*/
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
@@ -647,7 +647,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API used to provide functions specific to the XFree86 and
+ * FreeType 2 API which provides functions specific to the XFree86 and
* X.Org X11 servers.
*/
#define FT_XFREE86_H <freetype/ftxf86.h>
@@ -660,11 +660,12 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API used to perform trigonometric computations (e.g.,
+ * FreeType 2 API which performs trigonometric computations (e.g.,
* cosines and arc tangents).
*/
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
+
/*************************************************************************
*
* @macro:
@@ -672,7 +673,7 @@
*
* @description:
* A macro used in #include statements to name the file containing the
- * FreeType 2 API used to perform color filtering for subpixel rendering
+ * FreeType 2 API which performs color filtering for subpixel rendering.
*/
#define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
diff --git a/include/freetype/ftlcdfil.h b/include/freetype/ftlcdfil.h
index 59cb875..5882921 100644
--- a/include/freetype/ftlcdfil.h
+++ b/include/freetype/ftlcdfil.h
@@ -1,89 +1,125 @@
+/***************************************************************************/
+/* */
+/* ftlcdfil.h */
+/* */
+/* FreeType API for color filtering of subpixel bitmap glyphs */
+/* (specification). */
+/* */
+/* Copyright 2006 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
#ifndef __FT_LCD_FILTER_H__
#define __FT_LCD_FILTER_H__
#include <ft2build.h>
#include FT_FREETYPE_H
+
FT_BEGIN_HEADER
- /**
- * @func: FT_Library_SetLcdFilter
- *
- * @description:
- * this function is used to apply color filtering to LCD decimated
- * bitmaps, like the ones used when calling @FT_Render_Glyph with
- * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
- *
- * @input:
- * library :: handle to target library instance
- *
- * filter_weights :: a pointer to an array of 5 bytes corresponding
- * to the weights of a 5-tap FIR filter. Each
- * weight must be positive, and their sum should
- * be at least 256 to avoid loss of darkness
- * in the rendered glyphs. The sum can be greater
- * than 256 to darken the glyphs (el-cheapo gamma)
- *
- * you can use @FT_LCD_FILTER_NONE here to disable
- * this feature, or @FT_LCD_FILTER_DEFAULT to use
- * a default filter that should work well on most
- * LCD screens.
- *
- * @return:
- * error code. 0 means success
- *
- * @note:
- * this feature is always disabled by default. Clients must make an
- * explicit call to this function with a 'filter_weights' value other
- * than @FT_LCD_FILTER_NONE in order to enable it.
- *
- * due to *PATENTS* covering subpixel rendering, this function will
- * not do anything except return @FT_Err_Unimplemented_Feature if the
- * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
- * defined in your build of the library, which should correspond
- * to all default builds of the library
- *
- * the filter affects glyph bitmaps rendered through
- * @FT_Render_Glyph, @FT_Glyph_Get_Bitmap, @FT_Load_Glyph and
- * @FT_Load_Char.
- *
- * It does *not* affect the output of @FT_Outline_Render
- * and @FT_Outline_Get_Bitmap.
- *
- * if this feature is activated, the dimensions of LCD glyph bitmaps
- * will be either larger or taller than the dimensions of the corresponding
- * outline with regards to the pixel grid. For example, for @FT_RENDER_MODE_LCD,
- * the filter adds up to 3 pixels to the left, and up to 3 pixels to the right.
- *
- * the bitmap offset values are adjusted correctly, so clients shouldn't need
- * to modify thei layout / glyph positioning code when enabling the filter.
- */
+
+
+ /**************************************************************************
+ *
+ * @func:
+ * FT_Library_SetLcdFilter
+ *
+ * @description:
+ * This function is used to apply color filtering to LCD decimated
+ * bitmaps, like the ones used when calling @FT_Render_Glyph with
+ * @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
+ *
+ * @input:
+ * library ::
+ * A handle to the target library instance.
+ *
+ * filter_weights ::
+ * A pointer to an array of 5 bytes corresponding to the weights of a
+ * 5-tap FIR filter. Each weight must be positive, and their sum
+ * should be at least 256 to avoid loss of darkness in the rendered
+ * glyphs. The sum can be greater than 256 to darken the glyphs
+ * (`el-cheapo gamma').
+ *
+ * You can use @FT_LCD_FILTER_NONE here to disable this feature, or
+ * @FT_LCD_FILTER_DEFAULT to use a default filter that should work
+ * well on most LCD screens.
+ *
+ * @return:
+ * FreeType error code. 0 means success.
+ *
+ * @note:
+ * This feature is always disabled by default. Clients must make an
+ * explicit call to this function with a `filter_weights' value other
+ * than @FT_LCD_FILTER_NONE in order to enable it.
+ *
+ * Due to *PATENTS* covering subpixel rendering, this function doesn't
+ * do anything except returning @FT_Err_Unimplemented_Feature if the
+ * configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
+ * defined in your build of the library, which should correspond to all
+ * default builds of the library.
+ *
+ * The filter affects glyph bitmaps rendered through FT_Render_Glyph,
+ * @@FT_Glyph_Get_Bitmap, @FT_Load_Glyph, and FT_Load_Char.
+ *
+ * It does _not_ affect the output of @FT_Outline_Render and
+ * @FT_Outline_Get_Bitmap.
+ *
+ * If this feature is activated, the dimensions of LCD glyph bitmaps are
+ * either larger or taller than the dimensions of the corresponding
+ * outline with regards to the pixel grid. For example, for
+ * @FT_RENDER_MODE_LCD, the filter adds up to 3 pixels to the left, and
+ * up to 3 pixels to the right.
+ *
+ * The bitmap offset values are adjusted correctly, so clients shouldn't
+ * need to modify their layout and glyph positioning code when enabling
+ * the filter.
+ *
+ */
FT_EXPORT( FT_Error )
- FT_Library_SetLcdFilter( FT_Library library,
- const FT_Byte* filter_weights );
-
-
- /**
- * @enum: FT_LCD_FILTER_XXX
- *
- * @desc: a list of constants correspond to useful lcd filter settings to
- * be used when calling @FT_Library_SetLcdFilter
- *
- * @values:
- * FT_LCD_FILTER_NONE :: the value NULL is reserved to indicate that
- * LCD color filtering should be disabled.
- *
- * FT_LCD_FILTER_DEFAULT ::
- * this value is reserved to indicate a default FIR filter that
- * should work well on most LCD screen. For the really curious,
- * it corresponds to the array 0x10, 0x40, 0x70, 0x40, 0x10
- */
-#define FT_LCD_FILTER_NONE ((const FT_Byte*)NULL )
-
-#define FT_LCD_FILTER_DEFAULT ((const FT_Byte*)(void*)(ft_ptrdiff_t)1)
-
-/* */
+ FT_Library_SetLcdFilter( FT_Library library,
+ const FT_Byte* filter_weights );
+
+
+
+ /**************************************************************************
+ *
+ * @enum:
+ * FT_LCD_FILTER_XXX
+ *
+ * @description:
+ * A list of constants which correspond to useful lcd filter settings
+ * for the @FT_Library_SetLcdFilter function.
+ *
+ * @values:
+ * FT_LCD_FILTER_NONE ::
+ * The value NULL is reserved to indicate that LCD color filtering
+ * should be disabled.
+ *
+ * FT_LCD_FILTER_DEFAULT ::
+ * This value is reserved to indicate a default FIR filter that should
+ * work well on most LCD screen. It corresponds to the array 0x10,
+ * 0x40, 0x70, 0x40, 0x10.
+ *
+ */
+#define FT_LCD_FILTER_NONE ( (const FT_Byte*)NULL )
+
+#define FT_LCD_FILTER_DEFAULT ( (const FT_Byte*)(void*)(ft_ptrdiff_t)1 )
+
+ /* */
+
FT_END_HEADER
#endif /* __FT_LCD_FILTER_H__ */
+
+
+/* END */
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 9f8704d..e1c1c1a 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -214,8 +214,8 @@ FT_BEGIN_HEADER
/* unpatented_hinting :: */
/* This boolean flag instructs the glyph loader that this font */
/* can only be loaded through the unpatented bytecode interpreter. */
- /* in this case, the auto-hinter will never be called for it. */
- /* except if you use FT_LOAD_FORCE_AUTOHINT */
+ /* In that case, the auto-hinter is never called for it, except if */
+ /* you use FT_LOAD_FORCE_AUTOHINT. */
/* */
typedef struct FT_Face_InternalRec_
{
@@ -639,6 +639,7 @@ FT_BEGIN_HEADER
FT_Render_Mode render_mode,
FT_Byte* weights );
+
/*************************************************************************/
/* */
/* <Struct> */
diff --git a/src/base/Jamfile b/src/base/Jamfile
index 8999a22..c6ac6b3 100644
--- a/src/base/Jamfile
+++ b/src/base/Jamfile
@@ -1,6 +1,6 @@
# FreeType 2 src/base Jamfile
#
-# Copyright 2001, 2002, 2003, 2004, 2005 by
+# Copyright 2001, 2002, 2003, 2004, 2005, 2006 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c
index ae1a221..1aa7a6c 100644
--- a/src/base/ftlcdfil.c
+++ b/src/base/ftlcdfil.c
@@ -1,79 +1,102 @@
+/***************************************************************************/
+/* */
+/* ftlcdfil.c */
+/* */
+/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
+/* */
+/* Copyright 2006 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
#include <ft2build.h>
#include FT_LCD_FILTER_H
#include FT_IMAGE_H
#include FT_INTERNAL_OBJECTS_H
+
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
- /* this function will be invoked from within the smooth
- * rasterizer
- */
+ /* The smooth rasterizer invokes this function. */
static void
_ft_lcd_filter( FT_Bitmap* bitmap,
FT_Render_Mode mode,
FT_Byte* weights )
{
- FT_UInt width = (FT_UInt) bitmap->width;
- FT_UInt height = (FT_UInt) bitmap->rows;
+ FT_UInt width = (FT_UInt)bitmap->width;
+ FT_UInt height = (FT_UInt)bitmap->rows;
+
/* horizontal in-place FIR filter */
if ( mode == FT_RENDER_MODE_LCD && width >= 4 )
{
- FT_Byte* line = bitmap->buffer;
+ FT_Byte* line = bitmap->buffer;
+
for ( ; height > 0; height--, line += bitmap->pitch )
{
- FT_UInt fir[5];
- FT_UInt val1, xx;
+ FT_UInt fir[5];
+ FT_UInt val1, xx;
+
val1 = line[0];
- fir[0] = weights[2]*val1;
- fir[1] = weights[3]*val1;
- fir[2] = weights[4]*val1;
+ fir[0] = weights[2] * val1;
+ fir[1] = weights[3] * val1;
+ fir[2] = weights[4] * val1;
fir[3] = 0;
fir[4] = 0;
-
val1 = line[1];
- fir[0] += weights[1]*val1;
- fir[1] += weights[2]*val1;
- fir[2] += weights[3]*val1;
- fir[3] += weights[4]*val1;
+ fir[0] += weights[1] * val1;
+ fir[1] += weights[2] * val1;
+ fir[2] += weights[3] * val1;
+ fir[3] += weights[4] * val1;
for ( xx = 2; xx < width; xx++ )
{
FT_UInt val, pix;
+
val = line[xx];
- pix = fir[0] + weights[0]*val;
- fir[0] = fir[1] + weights[1]*val;
- fir[1] = fir[2] + weights[2]*val;
- fir[2] = fir[3] + weights[3]*val;
- fir[3] = weights[4]*val;
-
- pix >>= 8;
- pix |= -(pix >> 8);
- line[xx-2] = (FT_Byte)pix;
+ pix = fir[0] + weights[0] * val;
+ fir[0] = fir[1] + weights[1] * val;
+ fir[1] = fir[2] + weights[2] * val;
+ fir[2] = fir[3] + weights[3] * val;
+ fir[3] = weights[4] * val;
+
+ pix >>= 8;
+ pix |= -( pix >> 8 );
+ line[xx - 2] = (FT_Byte)pix;
}
{
FT_UInt pix;
- pix = fir[0] >> 8;
- pix |= -(pix >> 8);
- line[xx-2] = (FT_Byte)pix;
- pix = fir[1] >> 8;
- pix |= -(pix >> 8);
- line[xx-1] = (FT_Byte)pix;
+ pix = fir[0] >> 8;
+ pix |= -( pix >> 8 );
+ line[xx - 2] = (FT_Byte)pix;
+
+ pix = fir[1] >> 8;
+ pix |= -( pix >> 8 );
+ line[xx - 1] = (FT_Byte)pix;
}
}
}
+
/* vertical in-place FIR filter */
else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 )
{
- FT_Byte* column = bitmap->buffer;
- FT_Int pitch = bitmap->pitch;
+ FT_Byte* column = bitmap->buffer;
+ FT_Int pitch = bitmap->pitch;
+
for ( ; width > 0; width--, column++ )
{
@@ -81,47 +104,50 @@
FT_UInt fir[5];
FT_UInt val1, yy;
+
val1 = col[0];
- fir[0] = weights[2]*val1;
- fir[1] = weights[3]*val1;
- fir[2] = weights[4]*val1;
+ fir[0] = weights[2] * val1;
+ fir[1] = weights[3] * val1;
+ fir[2] = weights[4] * val1;
fir[3] = 0;
fir[4] = 0;
col += pitch;
val1 = col[0];
- fir[0] += weights[1]*val1;
- fir[1] += weights[2]*val1;
- fir[2] += weights[3]*val1;
- fir[3] += weights[4]*val1;
+ fir[0] += weights[1] * val1;
+ fir[1] += weights[2] * val1;
+ fir[2] += weights[3] * val1;
+ fir[3] += weights[4] * val1;
col += pitch;
for ( yy = 2; yy < height; yy++ )
{
FT_UInt val, pix;
+
val = col[0];
- pix = fir[0] + weights[0]*val;
- fir[0] = fir[1] + weights[1]*val;
- fir[1] = fir[2] + weights[2]*val;
- fir[2] = fir[3] + weights[3]*val;
- fir[3] = weights[4]*val;
-
- pix >>= 8;
- pix |= -(pix >> 8);
- col[-2*pitch] = (FT_Byte)pix;
- col += pitch;
+ pix = fir[0] + weights[0] * val;
+ fir[0] = fir[1] + weights[1] * val;
+ fir[1] = fir[2] + weights[2] * val;
+ fir[2] = fir[3] + weights[3] * val;
+ fir[3] = weights[4] * val;
+
+ pix >>= 8;
+ pix |= -( pix >> 8 );
+ col[-2 * pitch] = (FT_Byte)pix;
+ col += pitch;
}
{
FT_UInt pix;
- pix = fir[0] >> 8;
- pix |= -(pix >> 8);
- col[-2*pitch] = (FT_Byte)pix;
+
+ pix = fir[0] >> 8;
+ pix |= -( pix >> 8 );
+ col[-2 * pitch] = (FT_Byte)pix;
pix = fir[1] >> 8;
- pix |= -(pix >> 8);
+ pix |= -( pix >> 8 );
col[-pitch] = (FT_Byte)pix;
}
}
@@ -130,11 +156,12 @@
FT_EXPORT( FT_Error )
- FT_Library_SetLcdFilter( FT_Library library,
- const FT_Byte* filter_weights )
+ FT_Library_SetLcdFilter( FT_Library library,
+ const FT_Byte* filter_weights )
{
static const FT_Byte default_filter[5] = { 0x10, 0x40, 0x70, 0x40, 0x10 };
+
if ( library == NULL )
return FT_Err_Invalid_Argument;
@@ -153,17 +180,19 @@
return 0;
}
-#else
+#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
FT_EXPORT( FT_Error )
- FT_Library_SetLcdFilter( FT_Library library,
- const FT_Byte* filter_weights )
+ FT_Library_SetLcdFilter( FT_Library library,
+ const FT_Byte* filter_weights )
{
- FT_UNUSED(library);
- FT_UNUSED(filter_weights);
+ FT_UNUSED( library );
+ FT_UNUSED( filter_weights );
return FT_Err_Unimplemented_Feature;
}
+#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+
-#endif
+/* END */
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index f17f1a6..ad19645 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -106,8 +106,8 @@
FT_UInt width, height, height_org, width_org, pitch;
FT_Bitmap* bitmap;
FT_Memory memory;
- FT_Int hmul = (mode == FT_RENDER_MODE_LCD);
- FT_Int vmul = (mode == FT_RENDER_MODE_LCD_V);
+ FT_Int hmul = mode == FT_RENDER_MODE_LCD;
+ FT_Int vmul = mode == FT_RENDER_MODE_LCD_V;
FT_Pos x_shift, y_shift, x_left, y_top;
FT_Raster_Params params;
@@ -170,6 +170,7 @@
y_top = (FT_Int)( cbox.yMax >> 6 );
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
+
if ( slot->library->lcd_filter )
{
if ( hmul )
@@ -186,6 +187,7 @@
y_top += 1;
}
}
+
#endif
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
diff --git a/vms_make.com b/vms_make.com
index 5411ce3..98fc11d 100644
--- a/vms_make.com
+++ b/vms_make.com
@@ -1,6 +1,6 @@
$! make Freetype2 under OpenVMS
$!
-$! Copyright 2003, 2004 by
+$! Copyright 2003, 2004, 2006 by
$! David Turner, Robert Wilhelm, and Werner Lemberg.
$!
$! This file is part of the FreeType project, and may only be used, modified,