155d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod/*
255d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * Copyright © 2017  Google, Inc.
355d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod *
455d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod *
655d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * Permission is hereby granted, without written agreement and without
755d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
855d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * software and its documentation for any purpose, provided that the
955d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
1055d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * all copies of this software.
1155d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod *
1255d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
1355d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
1455d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
1555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
1655d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * DAMAGE.
1755d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod *
1855d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
1955d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2055d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
2155d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
2255d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
2355d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod *
2455d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
2555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod */
2655d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
2755d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod#ifndef HB_OT_H_IN
2855d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod#error "Include <hb-ot.h> instead."
2955d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod#endif
3055d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
3155d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod#ifndef HB_OT_VAR_H
3255d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod#define HB_OT_VAR_H
3355d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
3455d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod#include "hb.h"
3555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
3655d42fd667b9c34a1109bb850bf2ea7322c01040Behdad EsfahbodHB_BEGIN_DECLS
3755d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
3855d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
397a860f656e4aec45c45e0f5fb28c49a91dc5eef2Behdad Esfahbod#define HB_OT_TAG_VAR_AXIS_ITALIC	HB_TAG('i','t','a','l')
407a860f656e4aec45c45e0f5fb28c49a91dc5eef2Behdad Esfahbod#define HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE	HB_TAG('o','p','s','z')
417a860f656e4aec45c45e0f5fb28c49a91dc5eef2Behdad Esfahbod#define HB_OT_TAG_VAR_AXIS_SLANT	HB_TAG('s','l','n','t')
427a860f656e4aec45c45e0f5fb28c49a91dc5eef2Behdad Esfahbod#define HB_OT_TAG_VAR_AXIS_WIDTH	HB_TAG('w','d','t','h')
437a860f656e4aec45c45e0f5fb28c49a91dc5eef2Behdad Esfahbod#define HB_OT_TAG_VAR_AXIS_WEIGHT	HB_TAG('w','g','h','t')
447a860f656e4aec45c45e0f5fb28c49a91dc5eef2Behdad Esfahbod
4555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
4655d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod/*
4755d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * fvar / avar
4855d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod */
4955d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
5055d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod/**
5155d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * hb_ot_var_axis_t:
5255d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod *
5355d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod * Since: 1.4.2
5455d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod */
5555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbodtypedef struct hb_ot_var_axis_t {
5655d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod  hb_tag_t tag;
5755d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod  unsigned int name_id;
58469926cc45760cb681d44e5757b18b9bdd736189Behdad Esfahbod  float min_value;
59422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbod  float default_value;
60469926cc45760cb681d44e5757b18b9bdd736189Behdad Esfahbod  float max_value;
6155d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod} hb_ot_var_axis_t;
6255d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
6355d42fd667b9c34a1109bb850bf2ea7322c01040Behdad EsfahbodHB_EXTERN hb_bool_t
6455d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbodhb_ot_var_has_data (hb_face_t *face);
6555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
66d2f249e745a9179943ee39c719b73e1057acbc13Behdad Esfahbod/**
67d2f249e745a9179943ee39c719b73e1057acbc13Behdad Esfahbod * HB_OT_VAR_NO_AXIS_INDEX:
68d2f249e745a9179943ee39c719b73e1057acbc13Behdad Esfahbod *
69d2f249e745a9179943ee39c719b73e1057acbc13Behdad Esfahbod * Since: 1.4.2
70d2f249e745a9179943ee39c719b73e1057acbc13Behdad Esfahbod */
71422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbod#define HB_OT_VAR_NO_AXIS_INDEX		0xFFFFFFFFu
72422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbod
73785982bf830723552270db5649abcb9f9f0b46b1Behdad EsfahbodHB_EXTERN unsigned int
74785982bf830723552270db5649abcb9f9f0b46b1Behdad Esfahbodhb_ot_var_get_axis_count (hb_face_t *face);
75785982bf830723552270db5649abcb9f9f0b46b1Behdad Esfahbod
76785982bf830723552270db5649abcb9f9f0b46b1Behdad EsfahbodHB_EXTERN unsigned int
77785982bf830723552270db5649abcb9f9f0b46b1Behdad Esfahbodhb_ot_var_get_axes (hb_face_t        *face,
78785982bf830723552270db5649abcb9f9f0b46b1Behdad Esfahbod		    unsigned int      start_offset,
79785982bf830723552270db5649abcb9f9f0b46b1Behdad Esfahbod		    unsigned int     *axes_count /* IN/OUT */,
80785982bf830723552270db5649abcb9f9f0b46b1Behdad Esfahbod		    hb_ot_var_axis_t *axes_array /* OUT */);
8155d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
82422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad EsfahbodHB_EXTERN hb_bool_t
83422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbodhb_ot_var_find_axis (hb_face_t        *face,
84422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbod		     hb_tag_t          axis_tag,
85422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbod		     unsigned int     *axis_index,
86422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbod		     hb_ot_var_axis_t *axis_info);
87422c0c36c80145a2d993f80d5c7d3265e3d8357aBehdad Esfahbod
8855d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
895ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad EsfahbodHB_EXTERN void
905ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbodhb_ot_var_normalize_variations (hb_face_t            *face,
915ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod				const hb_variation_t *variations, /* IN */
925ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod				unsigned int          variations_length,
935ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod				int                  *coords, /* OUT */
945ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod				unsigned int          coords_length);
955ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod
965ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad EsfahbodHB_EXTERN void
975ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbodhb_ot_var_normalize_coords (hb_face_t    *face,
985ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod			    unsigned int coords_length,
995ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod			    const float *design_coords, /* IN */
1005ec96d30cad1592b5e468bd8ad1832dbaf0ad32bBehdad Esfahbod			    int *normalized_coords /* OUT */);
101785982bf830723552270db5649abcb9f9f0b46b1Behdad Esfahbod
10255d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
10355d42fd667b9c34a1109bb850bf2ea7322c01040Behdad EsfahbodHB_END_DECLS
10455d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod
10555d42fd667b9c34a1109bb850bf2ea7322c01040Behdad Esfahbod#endif /* HB_OT_VAR_H */
106