Imported Upstream version 2.3.1
[platform/upstream/harfbuzz.git] / src / hb-ot-layout.h
index 0278796..e473954 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "hb.h"
 
-#include "hb-ot-tag.h"
+#include "hb-ot-name.h"
 
 HB_BEGIN_DECLS
 
@@ -46,6 +46,47 @@ HB_BEGIN_DECLS
 
 
 /*
+ * Script & Language tags.
+ */
+
+#define HB_OT_TAG_DEFAULT_SCRIPT       HB_TAG ('D', 'F', 'L', 'T')
+#define HB_OT_TAG_DEFAULT_LANGUAGE     HB_TAG ('d', 'f', 'l', 't')
+
+/**
+ * HB_OT_MAX_TAGS_PER_SCRIPT:
+ *
+ * Since: 2.0.0
+ **/
+#define HB_OT_MAX_TAGS_PER_SCRIPT      3u
+/**
+ * HB_OT_MAX_TAGS_PER_LANGUAGE:
+ *
+ * Since: 2.0.0
+ **/
+#define HB_OT_MAX_TAGS_PER_LANGUAGE    3u
+
+HB_EXTERN void
+hb_ot_tags_from_script_and_language (hb_script_t   script,
+                                    hb_language_t language,
+                                    unsigned int *script_count /* IN/OUT */,
+                                    hb_tag_t     *script_tags /* OUT */,
+                                    unsigned int *language_count /* IN/OUT */,
+                                    hb_tag_t     *language_tags /* OUT */);
+
+HB_EXTERN hb_script_t
+hb_ot_tag_to_script (hb_tag_t tag);
+
+HB_EXTERN hb_language_t
+hb_ot_tag_to_language (hb_tag_t tag);
+
+HB_EXTERN void
+hb_ot_tags_to_script_and_language (hb_tag_t       script_tag,
+                                  hb_tag_t       language_tag,
+                                  hb_script_t   *script /* OUT */,
+                                  hb_language_t *language /* OUT */);
+
+
+/*
  * GDEF
  */
 
@@ -111,13 +152,13 @@ hb_ot_layout_table_find_script (hb_face_t    *face,
                                hb_tag_t      script_tag,
                                unsigned int *script_index);
 
-/* Like find_script, but takes zero-terminated array of scripts to test */
 HB_EXTERN hb_bool_t
-hb_ot_layout_table_choose_script (hb_face_t      *face,
+hb_ot_layout_table_select_script (hb_face_t      *face,
                                  hb_tag_t        table_tag,
+                                 unsigned int    script_count,
                                  const hb_tag_t *script_tags,
-                                 unsigned int   *script_index,
-                                 hb_tag_t       *chosen_script);
+                                 unsigned int   *script_index /* OUT */,
+                                 hb_tag_t       *chosen_script /* OUT */);
 
 HB_EXTERN unsigned int
 hb_ot_layout_table_get_feature_tags (hb_face_t    *face,
@@ -135,11 +176,12 @@ hb_ot_layout_script_get_language_tags (hb_face_t    *face,
                                       hb_tag_t     *language_tags /* OUT */);
 
 HB_EXTERN hb_bool_t
-hb_ot_layout_script_find_language (hb_face_t    *face,
-                                  hb_tag_t      table_tag,
-                                  unsigned int  script_index,
-                                  hb_tag_t      language_tag,
-                                  unsigned int *language_index);
+hb_ot_layout_script_select_language (hb_face_t      *face,
+                                    hb_tag_t        table_tag,
+                                    unsigned int    script_index,
+                                    unsigned int    language_count,
+                                    const hb_tag_t *language_tags,
+                                    unsigned int   *language_index /* OUT */);
 
 HB_EXTERN hb_bool_t
 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
@@ -194,6 +236,13 @@ HB_EXTERN unsigned int
 hb_ot_layout_table_get_lookup_count (hb_face_t    *face,
                                     hb_tag_t      table_tag);
 
+HB_EXTERN void
+hb_ot_layout_collect_features (hb_face_t      *face,
+                               hb_tag_t        table_tag,
+                               const hb_tag_t *scripts,
+                               const hb_tag_t *languages,
+                               const hb_tag_t *features,
+                               hb_set_t       *feature_indexes /* OUT */);
 
 HB_EXTERN void
 hb_ot_layout_collect_lookups (hb_face_t      *face,
@@ -207,10 +256,10 @@ HB_EXTERN void
 hb_ot_layout_lookup_collect_glyphs (hb_face_t    *face,
                                    hb_tag_t      table_tag,
                                    unsigned int  lookup_index,
-                                   hb_set_t     *glyphs_before, /* OUT. May be NULL */
-                                   hb_set_t     *glyphs_input,  /* OUT. May be NULL */
-                                   hb_set_t     *glyphs_after,  /* OUT. May be NULL */
-                                   hb_set_t     *glyphs_output  /* OUT. May be NULL */);
+                                   hb_set_t     *glyphs_before, /* OUT.  May be NULL */
+                                   hb_set_t     *glyphs_input,  /* OUT.  May be NULL */
+                                   hb_set_t     *glyphs_after,  /* OUT.  May be NULL */
+                                   hb_set_t     *glyphs_output  /* OUT.  May be NULL */);
 
 #ifdef HB_NOT_IMPLEMENTED
 typedef struct
@@ -315,29 +364,32 @@ Xhb_ot_layout_lookup_position (hb_font_t            *font,
 /* Optical 'size' feature info.  Returns true if found.
  * https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#size */
 HB_EXTERN hb_bool_t
-hb_ot_layout_get_size_params (hb_face_t    *face,
-                             unsigned int *design_size,       /* OUT.  May be NULL */
-                             unsigned int *subfamily_id,      /* OUT.  May be NULL */
-                             unsigned int *subfamily_name_id, /* OUT.  May be NULL */
-                             unsigned int *range_start,       /* OUT.  May be NULL */
-                             unsigned int *range_end          /* OUT.  May be NULL */);
-
+hb_ot_layout_get_size_params (hb_face_t       *face,
+                             unsigned int    *design_size,       /* OUT.  May be NULL */
+                             unsigned int    *subfamily_id,      /* OUT.  May be NULL */
+                             hb_ot_name_id_t *subfamily_name_id, /* OUT.  May be NULL */
+                             unsigned int    *range_start,       /* OUT.  May be NULL */
+                             unsigned int    *range_end          /* OUT.  May be NULL */);
 
-/*
- * BASE
- */
-#if 0
 
-#define HB_OT_TAG_BASE_HANG HB_TAG('h','a','n','g')
-#define HB_OT_TAG_BASE_ICFB HB_TAG('i','c','f','b')
-#define HB_OT_TAG_BASE_ICFT HB_TAG('i','c','f','t')
-#define HB_OT_TAG_BASE_IDEO HB_TAG('i','d','e','o')
-#define HB_OT_TAG_BASE_IDTB HB_TAG('i','d','t','b')
-#define HB_OT_TAG_BASE_MATH HB_TAG('m','a','t','h')
-#define HB_OT_TAG_BASE_ROMN HB_TAG('r','o','m','n')
+HB_EXTERN hb_bool_t
+hb_ot_layout_feature_get_name_ids (hb_face_t       *face,
+                                  hb_tag_t         table_tag,
+                                  unsigned int     feature_index,
+                                  hb_ot_name_id_t *label_id             /* OUT.  May be NULL */,
+                                  hb_ot_name_id_t *tooltip_id           /* OUT.  May be NULL */,
+                                  hb_ot_name_id_t *sample_id            /* OUT.  May be NULL */,
+                                  unsigned int    *num_named_parameters /* OUT.  May be NULL */,
+                                  hb_ot_name_id_t *first_param_id       /* OUT.  May be NULL */);
 
-#endif
 
+HB_EXTERN unsigned int
+hb_ot_layout_feature_get_characters (hb_face_t      *face,
+                                    hb_tag_t        table_tag,
+                                    unsigned int    feature_index,
+                                    unsigned int    start_offset,
+                                    unsigned int   *char_count    /* IN/OUT.  May be NULL */,
+                                    hb_codepoint_t *characters    /* OUT.     May be NULL */);
 
 HB_END_DECLS