1049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/***************************************************************************/
2049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*                                                                         */
3049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*  afindic.c                                                              */
4049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*                                                                         */
59c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod/*    Auto-fitter hinting routines for Indic writing system (body).        */
6049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*                                                                         */
7727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease/*  Copyright 2007, 2011-2013 by                                           */
8049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*  Rahul Bhalerao <rahul.bhalerao@redhat.com>, <b.rahul.pm@gmail.com>.    */
9049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*                                                                         */
10049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*  This file is part of the FreeType project, and may only be used,       */
11049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*  modified, and distributed under the terms of the FreeType project      */
12049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
13049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*  this file you indicate that you have read the license and              */
14049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*  understand and accept it fully.                                        */
15049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/*                                                                         */
16049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/***************************************************************************/
17049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
18049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
19049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#include "aftypes.h"
20049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#include "aflatin.h"
21049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
22049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
23049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#ifdef AF_CONFIG_OPTION_INDIC
24049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
25049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#include "afindic.h"
26049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#include "aferrors.h"
27049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#include "afcjk.h"
28049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
29049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
30aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner#ifdef AF_CONFIG_OPTION_USE_WARPER
31049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#include "afwarp.h"
32049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#endif
33049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
34049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
35049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  static FT_Error
36aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner  af_indic_metrics_init( AF_CJKMetrics  metrics,
37aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner                         FT_Face        face )
38049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  {
39aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    /* skip blue zone init in CJK routines */
40aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    FT_CharMap  oldmap = face->charmap;
41aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner
42aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner
43aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    metrics->units_per_em = face->units_per_EM;
44aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner
45aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    if ( FT_Select_Charmap( face, FT_ENCODING_UNICODE ) )
46aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner      face->charmap = NULL;
47aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    else
48aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    {
49727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease      af_cjk_metrics_init_widths( metrics, face );
50aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner#if 0
51aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner      /* either need indic specific blue_chars[] or just skip blue zones */
52aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner      af_cjk_metrics_init_blues( metrics, face, af_cjk_blue_chars );
53aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner#endif
54aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner      af_cjk_metrics_check_digits( metrics, face );
55aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    }
56aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner
57aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner    FT_Set_Charmap( face, oldmap );
58aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner
59727dee178a392d20eb050d0c446f2fcc29058fa1Victoria Lease    return FT_Err_Ok;
60049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  }
61049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
62049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
63049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  static void
64aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner  af_indic_metrics_scale( AF_CJKMetrics  metrics,
65aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner                          AF_Scaler      scaler )
66049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  {
67049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project    /* use CJK routines */
68049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project    af_cjk_metrics_scale( metrics, scaler );
69049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  }
70049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
71049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
72049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  static FT_Error
73aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner  af_indic_hints_init( AF_GlyphHints  hints,
74aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner                       AF_CJKMetrics  metrics )
75049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  {
76049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project    /* use CJK routines */
77049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project    return af_cjk_hints_init( hints, metrics );
78049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  }
79049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
80049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
81049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  static FT_Error
82aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner  af_indic_hints_apply( AF_GlyphHints  hints,
83aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner                        FT_Outline*    outline,
84aeb407daf3711a10a27f3bc2223c5eb05158076eDavid 'Digit' Turner                        AF_CJKMetrics  metrics )
85049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  {
86049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project    /* use CJK routines */
87049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project    return af_cjk_hints_apply( hints, outline, metrics );
88049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  }
89049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
90049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
91049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  /*************************************************************************/
92049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  /*************************************************************************/
93049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  /*****                                                               *****/
94049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  /*****                I N D I C   S C R I P T   C L A S S            *****/
95049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  /*****                                                               *****/
96049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  /*************************************************************************/
97049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project  /*************************************************************************/
98049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
99049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
100ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease  AF_DEFINE_WRITING_SYSTEM_CLASS(
101ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    af_indic_writing_system_class,
102049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
103ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    AF_WRITING_SYSTEM_INDIC,
104049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
10541371e1e39c8528eb0c4bc40683c736e6683e60cEric Vannier    sizeof ( AF_CJKMetricsRec ),
106049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
1079c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_InitMetricsFunc) af_indic_metrics_init,
1089c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_ScaleMetricsFunc)af_indic_metrics_scale,
1099c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_DoneMetricsFunc) NULL,
110049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
1119c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_InitHintsFunc)   af_indic_hints_init,
1129c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_ApplyHintsFunc)  af_indic_hints_apply
113295ffce55e0198e7a9f7d46b33f5c2b4147bf821David 'Digit' Turner  )
114049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
115049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
116ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease#else /* !AF_CONFIG_OPTION_INDIC */
117ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
1189c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod
119ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease  AF_DEFINE_WRITING_SYSTEM_CLASS(
120ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    af_indic_writing_system_class,
121ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
122ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease    AF_WRITING_SYSTEM_INDIC,
123049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
12441371e1e39c8528eb0c4bc40683c736e6683e60cEric Vannier    sizeof ( AF_CJKMetricsRec ),
125049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
1269c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_InitMetricsFunc) NULL,
1279c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_ScaleMetricsFunc)NULL,
1289c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_DoneMetricsFunc) NULL,
129049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
1309c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_InitHintsFunc)   NULL,
1319c745321260bb728ab1cd1c8fd5f075854b2ad49Behdad Esfahbod    (AF_WritingSystem_ApplyHintsFunc)  NULL
132295ffce55e0198e7a9f7d46b33f5c2b4147bf821David 'Digit' Turner  )
133049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
134ec0bab5697bb31ba980810145f62e3799946ec60Victoria Lease
135049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project#endif /* !AF_CONFIG_OPTION_INDIC */
136049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
137049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project
138049d6fea481044fcc000e7782e5bc7046fc70844The Android Open Source Project/* END */
139