blob: ec2d707c9f9daf09069f50102857be5c75c07436 [file] [log] [blame]
Werner Lembergf13516c2005-03-03 17:09:08 +00001/***************************************************************************/
2/* */
3/* afmodule.c */
4/* */
5/* Auto-fitter module implementation (body). */
6/* */
Werner Lemberg111b5ae2006-11-03 09:40:12 +00007/* Copyright 2003, 2004, 2005, 2006 by */
Werner Lembergf13516c2005-03-03 17:09:08 +00008/* 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
David Turner8ccb4552004-01-16 09:51:00 +000019#include "afmodule.h"
David Turnerf546bac2004-02-01 16:59:06 +000020#include "afloader.h"
Oran Agra59b4af82009-04-05 18:23:38 +030021#include "afpic.h"
Werner Lembergf13516c2005-03-03 17:09:08 +000022
David Turner6f8c6222006-09-26 15:42:44 +000023#ifdef AF_DEBUG
Werner Lemberg111b5ae2006-11-03 09:40:12 +000024 int _af_debug;
25 int _af_debug_disable_horz_hints;
26 int _af_debug_disable_vert_hints;
27 int _af_debug_disable_blue_hints;
David Turner40604742006-11-02 16:37:35 +000028 void* _af_debug_hints;
David Turner6f8c6222006-09-26 15:42:44 +000029#endif
30
David Turnerf546bac2004-02-01 16:59:06 +000031#include FT_INTERNAL_OBJECTS_H
David Turner8ccb4552004-01-16 09:51:00 +000032
Werner Lembergf13516c2005-03-03 17:09:08 +000033
David Turnerf546bac2004-02-01 16:59:06 +000034 typedef struct FT_AutofitterRec_
David Turner8ccb4552004-01-16 09:51:00 +000035 {
David Turnerf546bac2004-02-01 16:59:06 +000036 FT_ModuleRec root;
37 AF_LoaderRec loader[1];
David Turner8ccb4552004-01-16 09:51:00 +000038
David Turnerf546bac2004-02-01 16:59:06 +000039 } FT_AutofitterRec, *FT_Autofitter;
David Turner8ccb4552004-01-16 09:51:00 +000040
David Turner8ccb4552004-01-16 09:51:00 +000041
David Turnerf546bac2004-02-01 16:59:06 +000042 FT_CALLBACK_DEF( FT_Error )
43 af_autofitter_init( FT_Autofitter module )
44 {
45 return af_loader_init( module->loader, module->root.library->memory );
David Turner8ccb4552004-01-16 09:51:00 +000046 }
47
48
David Turnerf546bac2004-02-01 16:59:06 +000049 FT_CALLBACK_DEF( void )
50 af_autofitter_done( FT_Autofitter module )
David Turner8ccb4552004-01-16 09:51:00 +000051 {
David Turnerf546bac2004-02-01 16:59:06 +000052 af_loader_done( module->loader );
David Turner8ccb4552004-01-16 09:51:00 +000053 }
David Turnerf546bac2004-02-01 16:59:06 +000054
55
56 FT_CALLBACK_DEF( FT_Error )
57 af_autofitter_load_glyph( FT_Autofitter module,
58 FT_GlyphSlot slot,
59 FT_Size size,
60 FT_UInt glyph_index,
61 FT_Int32 load_flags )
62 {
Werner Lemberg07dcc102004-04-21 22:27:11 +000063 FT_UNUSED( size );
David Turner10bf05a2004-04-21 14:30:37 +000064
David Turnerf546bac2004-02-01 16:59:06 +000065 return af_loader_load_glyph( module->loader, slot->face,
66 glyph_index, load_flags );
67 }
68
69
Oran Agra59b4af82009-04-05 18:23:38 +030070 FT_DEFINE_AUTOHINTER_SERVICE(af_autofitter_service,
David Turnerf546bac2004-02-01 16:59:06 +000071 NULL,
72 NULL,
73 NULL,
Werner Lembergf13516c2005-03-03 17:09:08 +000074 (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph
Oran Agra59b4af82009-04-05 18:23:38 +030075 )
David Turnerf546bac2004-02-01 16:59:06 +000076
Oran Agra59b4af82009-04-05 18:23:38 +030077 FT_DEFINE_MODULE(autofit_module_class,
David Turnerf546bac2004-02-01 16:59:06 +000078
David Turnerf546bac2004-02-01 16:59:06 +000079 FT_MODULE_HINTER,
80 sizeof ( FT_AutofitterRec ),
81
82 "autofitter",
83 0x10000L, /* version 1.0 of the autofitter */
84 0x20000L, /* requires FreeType 2.0 or above */
85
Oran Agra59b4af82009-04-05 18:23:38 +030086 (const void*)&AF_AF_AUTOFITTER_SERVICE_GET,
David Turnerf546bac2004-02-01 16:59:06 +000087
Werner Lembergf13516c2005-03-03 17:09:08 +000088 (FT_Module_Constructor)af_autofitter_init,
89 (FT_Module_Destructor) af_autofitter_done,
90 (FT_Module_Requester) NULL
Oran Agra59b4af82009-04-05 18:23:38 +030091 )
David Turnerf546bac2004-02-01 16:59:06 +000092
93
94/* END */