diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-10 13:54:33 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-02-17 14:01:45 -0600 |
commit | b2a37b16b4773eefbc8edcadef15cd8bb677659c (patch) | |
tree | 28f783d1ba3eb45772efb2b9bbe2b9ddb7a19893 | |
parent | 05fb268ea10f662967ab56a6e425d81261dcbe12 (diff) | |
download | pango-b2a37b16b4773eefbc8edcadef15cd8bb677659c.tar.gz |
Drop pangoot
-rw-r--r-- | pango/meson.build | 45 | ||||
-rw-r--r-- | pango/pango-ot-buffer.c | 229 | ||||
-rw-r--r-- | pango/pango-ot-info.c | 325 | ||||
-rw-r--r-- | pango/pango-ot-private.h | 89 | ||||
-rw-r--r-- | pango/pango-ot-ruleset.c | 407 | ||||
-rw-r--r-- | pango/pango-ot-tag.c | 135 | ||||
-rw-r--r-- | pango/pango-ot.h | 427 | ||||
-rw-r--r-- | tests/testmisc.c | 29 |
8 files changed, 3 insertions, 1683 deletions
diff --git a/pango/meson.build b/pango/meson.build index f53418a7..76b282f3 100644 --- a/pango/meson.build +++ b/pango/meson.build @@ -201,17 +201,6 @@ if build_pangoft2 'pango-trace.c', ] - pangoot_headers = [ - 'pango-ot.h', - ] - - pangoot_public_sources = [ - 'pango-ot-buffer.c', - 'pango-ot-info.c', - 'pango-ot-ruleset.c', - 'pango-ot-tag.c', - ] - pangoft2_headers = [ 'pangoft2.h', ] @@ -222,7 +211,7 @@ if build_pangoft2 'pangoft2.c', ] - pangoft2_sources = pangofc_public_sources + pangoot_public_sources + pangoft2_public_sources + pangoft2_sources = pangofc_public_sources + pangoft2_public_sources if host_system == 'windows' pangoft2_rc = configure_file( @@ -234,7 +223,7 @@ if build_pangoft2 pangoft2_sources += pangoft2_res endif - install_headers(pangoft2_headers + pangofc_headers + pangoot_headers, subdir: pango_api_path) + install_headers(pangoft2_headers + pangofc_headers, subdir: pango_api_path) libpangoft2 = library( 'pangoft2-@0@'.format(pango_api_version), @@ -271,28 +260,10 @@ if build_pangoft2 pangofc_gir_dep = declare_dependency(sources: pangofc_gir) pangoft2_dep_sources += pangofc_gir - # Deprecated API, still needed for PangoXft - pangoot_gir = gnome.generate_gir( - libpangoft2, - sources: pangoot_headers + pangoot_public_sources, - dependencies: [ libpango_dep, pango_gir_dep, pangofc_gir_dep ], - namespace: 'PangoOT', - nsversion: pango_api_version, - identifier_prefix: 'PangoOT', - symbol_prefix: 'pango_ot', - export_packages: 'pangoot', - includes: [ pangofc_gir[0], 'freetype2-2.0', ], - header: 'pango/pango-ot.h', - install: true, - extra_args: gir_args, - ) - pangoot_gir_dep = declare_dependency(sources: pangoot_gir) - pangoft2_dep_sources += pangoot_gir - pangoft2_gir = gnome.generate_gir( libpangoft2, sources: pangoft2_headers + pangoft2_public_sources, - dependencies: [ libpango_dep, pango_gir_dep, pangofc_gir_dep, pangoot_gir_dep ], + dependencies: [ libpango_dep, pango_gir_dep, pangofc_gir_dep ], namespace: 'PangoFT2', nsversion: pango_api_version, identifier_prefix: 'PangoFT2', @@ -323,16 +294,6 @@ if build_pangoft2 requires: [ 'pango', freetype2_pc, fontconfig_pc ], ) - # Since we split the introspection data, we also need a split pkg-config - # file for Vala - pkgconfig.generate( - name: 'Pango OT', - description: 'OpenType font support for Pango (deprecated)', - filebase: 'pangoot', - subdirs: pango_api_name, - requires: [ 'pangoft2' ], - ) - pkgconfig.generate( name: 'Pango FC', description: 'Fontconfig support for Pango', diff --git a/pango/pango-ot-buffer.c b/pango/pango-ot-buffer.c deleted file mode 100644 index c48edae2..00000000 --- a/pango/pango-ot-buffer.c +++ /dev/null @@ -1,229 +0,0 @@ -/* Pango - * pango-ot-buffer.c: Buffer of glyphs for shaping/positioning - * - * Copyright (C) 2004 Red Hat Software - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include "pango-ot-private.h" - -static PangoOTBuffer * -pango_ot_buffer_copy (PangoOTBuffer *src) -{ - PangoOTBuffer *dst = g_slice_new (PangoOTBuffer); - - dst->buffer = hb_buffer_reference (src->buffer); - - return dst; -} - -G_DEFINE_BOXED_TYPE (PangoOTBuffer, pango_ot_buffer, - pango_ot_buffer_copy, - pango_ot_buffer_destroy) - -/** - * pango_ot_buffer_new: - * @font: a `PangoFcFont` - * - * Creates a new `PangoOTBuffer` for the given OpenType font. - * - * Return value: the newly allocated `PangoOTBuffer`, which should - * be freed with [method@PangoOT.Buffer.destroy]. - * - * Since: 1.4 - */ -PangoOTBuffer * -pango_ot_buffer_new (PangoFcFont *font) -{ - PangoOTBuffer *buffer = g_slice_new (PangoOTBuffer); - - buffer->buffer = hb_buffer_create (); - - return buffer; -} - -/** - * pango_ot_buffer_destroy: - * @buffer: a `PangoOTBuffer` - * - * Destroys a `PangoOTBuffer` and free all associated memory. - * - * Since: 1.4 - */ -void -pango_ot_buffer_destroy (PangoOTBuffer *buffer) -{ - hb_buffer_destroy (buffer->buffer); - g_slice_free (PangoOTBuffer, buffer); -} - -/** - * pango_ot_buffer_clear: - * @buffer: a `PangoOTBuffer` - * - * Empties a `PangoOTBuffer`, make it ready to add glyphs to. - * - * Since: 1.4 - */ -void -pango_ot_buffer_clear (PangoOTBuffer *buffer) -{ - hb_buffer_reset (buffer->buffer); -} - -/** - * pango_ot_buffer_add_glyph: - * @buffer: a `PangoOTBuffer` - * @glyph: the glyph index to add, like a `PangoGlyph` - * @properties: the glyph properties - * @cluster: the cluster that this glyph belongs to - * - * Appends a glyph to a `PangoOTBuffer`, with @properties identifying which - * features should be applied on this glyph. - * - * See [method@PangoOT.Ruleset.add_feature]. - * - * Since: 1.4 - */ -void -pango_ot_buffer_add_glyph (PangoOTBuffer *buffer, - guint glyph, - guint properties, - guint cluster) -{ - hb_buffer_add (buffer->buffer, glyph, cluster); -} - -/** - * pango_ot_buffer_set_rtl: - * @buffer: a `PangoOTBuffer` - * @rtl: %TRUE for right-to-left text - * - * Sets whether glyphs will be rendered right-to-left. - * - * This setting is needed for proper horizontal positioning - * of right-to-left scripts. - * - * Since: 1.4 - */ -void -pango_ot_buffer_set_rtl (PangoOTBuffer *buffer, - gboolean rtl) -{ - hb_buffer_set_direction (buffer->buffer, rtl ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); -} - -/** - * pango_ot_buffer_set_zero_width_marks - * @buffer: a `PangoOTBuffer` - * @zero_width_marks: %TRUE if characters with a mark class should - * be forced to zero width - * - * Sets whether characters with a mark class should be forced to zero width. - * - * This setting is needed for proper positioning of Arabic accents, - * but will produce incorrect results with standard OpenType Indic - * fonts. - * - * Since: 1.6 - */ -void -pango_ot_buffer_set_zero_width_marks (PangoOTBuffer *buffer, - gboolean zero_width_marks) -{ -} - -/** - * pango_ot_buffer_get_glyphs - * @buffer: a `PangoOTBuffer` - * @glyphs: (array length=n_glyphs) (out) (optional): location to - * store the array of glyphs - * @n_glyphs: (out) (optional): location to store the number of glyphs - * - * Gets the glyph array contained in a `PangoOTBuffer`. - * - * The glyphs are owned by the buffer and should not be freed, - * and are only valid as long as buffer is not modified. - * - * Since: 1.4 - */ -void -pango_ot_buffer_get_glyphs (const PangoOTBuffer *buffer, - PangoOTGlyph **glyphs, - int *n_glyphs) -{ - if (glyphs) - *glyphs = (PangoOTGlyph *) hb_buffer_get_glyph_infos (buffer->buffer, NULL); - - if (n_glyphs) - *n_glyphs = hb_buffer_get_length (buffer->buffer); -} - -/** - * pango_ot_buffer_output - * @buffer: a `PangoOTBuffer` - * @glyphs: a `PangoGlyphString` - * - * Exports the glyphs in a `PangoOTBuffer` into a `PangoGlyphString`. - * - * This is typically used after the OpenType layout processing - * is over, to convert the resulting glyphs into a generic Pango - * glyph string. - * - * Since: 1.4 - */ -void -pango_ot_buffer_output (const PangoOTBuffer *buffer, - PangoGlyphString *glyphs) -{ - unsigned int i; - int last_cluster; - - unsigned int num_glyphs; - hb_buffer_t *hb_buffer = buffer->buffer; - hb_glyph_info_t *hb_glyph; - hb_glyph_position_t *hb_position; - - if (HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer->buffer))) - hb_buffer_reverse (buffer->buffer); - - /* Copy glyphs into output glyph string */ - num_glyphs = hb_buffer_get_length (hb_buffer); - hb_glyph = hb_buffer_get_glyph_infos (hb_buffer, NULL); - hb_position = hb_buffer_get_glyph_positions (hb_buffer, NULL); - pango_glyph_string_set_size (glyphs, num_glyphs); - last_cluster = -1; - for (i = 0; i < num_glyphs; i++) - { - glyphs->glyphs[i].glyph = hb_glyph->codepoint; - glyphs->log_clusters[i] = hb_glyph->cluster; - glyphs->glyphs[i].attr.is_cluster_start = glyphs->log_clusters[i] != last_cluster; - last_cluster = glyphs->log_clusters[i]; - - glyphs->glyphs[i].geometry.width = hb_position->x_advance; - glyphs->glyphs[i].geometry.x_offset = hb_position->x_offset; - glyphs->glyphs[i].geometry.y_offset = hb_position->y_offset; - - hb_glyph++; - hb_position++; - } - - if (HB_DIRECTION_IS_BACKWARD (hb_buffer_get_direction (buffer->buffer))) - hb_buffer_reverse (buffer->buffer); -} diff --git a/pango/pango-ot-info.c b/pango/pango-ot-info.c deleted file mode 100644 index 821c4f8b..00000000 --- a/pango/pango-ot-info.c +++ /dev/null @@ -1,325 +0,0 @@ -/* Pango - * pango-ot-info.c: Store tables for OpenType - * - * Copyright (C) 2000 Red Hat Software - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include "pango-ot-private.h" - -static void pango_ot_info_finalize (GObject *object); - -G_DEFINE_TYPE (PangoOTInfo, pango_ot_info, G_TYPE_OBJECT); - -static void -pango_ot_info_init (PangoOTInfo *self) -{ -} - -static void -pango_ot_info_class_init (PangoOTInfoClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = pango_ot_info_finalize; -} - -static void -pango_ot_info_finalize (GObject *object) -{ - PangoOTInfo *info = PANGO_OT_INFO (object); - - if (info->hb_face) - hb_face_destroy (info->hb_face); - - G_OBJECT_CLASS (pango_ot_info_parent_class)->finalize (object); -} - -static void -pango_ot_info_finalizer (void *object) -{ - FT_Face face = object; - PangoOTInfo *info = face->generic.data; - - info->face = NULL; - g_object_unref (info); -} - - -/** - * pango_ot_info_get: - * @face: a `FT_Face` - * - * Returns the `PangoOTInfo` structure for the given FreeType font face. - * - * Return value: (transfer none): the `PangoOTInfo` for @face. - * This object will have the same lifetime as @face. - * - * Since: 1.2 - */ -PangoOTInfo * -pango_ot_info_get (FT_Face face) -{ - PangoOTInfo *info; - - if (G_UNLIKELY (!face)) - return NULL; - - if (G_LIKELY (face->generic.data && face->generic.finalizer == pango_ot_info_finalizer)) - return face->generic.data; - else - { - if (face->generic.finalizer) - face->generic.finalizer (face); - - info = face->generic.data = g_object_new (PANGO_TYPE_OT_INFO, NULL); - face->generic.finalizer = pango_ot_info_finalizer; - - info->face = face; - info->hb_face = hb_ft_face_create (face, NULL); - } - - return info; -} - -static hb_tag_t -get_hb_table_type (PangoOTTableType table_type) -{ - switch (table_type) { - case PANGO_OT_TABLE_GSUB: return HB_OT_TAG_GSUB; - case PANGO_OT_TABLE_GPOS: return HB_OT_TAG_GPOS; - default: return HB_TAG_NONE; - } -} - -/** - * pango_ot_info_find_script: - * @info: a `PangoOTInfo` - * @table_type: the table type to obtain information about - * @script_tag: the tag of the script to find - * @script_index: (out) (optional): location to store the index of the script - * - * Finds the index of a script. - * - * If not found, tries to find the 'DFLT' and then 'dflt' scripts and - * return the index of that in @script_index. If none of those is found - * either, %PANGO_OT_NO_SCRIPT is placed in @script_index. - * - * All other functions taking an input script_index parameter know - * how to handle %PANGO_OT_NO_SCRIPT, so one can ignore the return - * value of this function completely and proceed, to enjoy the automatic - * fallback to the 'DFLT'/'dflt' script. - * - * Return value: %TRUE if the script was found - */ -gboolean -pango_ot_info_find_script (PangoOTInfo *info, - PangoOTTableType table_type, - PangoOTTag script_tag, - guint *script_index) -{ - hb_tag_t tt = get_hb_table_type (table_type); - - return hb_ot_layout_table_find_script (info->hb_face, tt, - script_tag, - script_index); -} - -/** - * pango_ot_info_find_language: - * @info: a `PangoOTInfo` - * @table_type: the table type to obtain information about - * @script_index: the index of the script whose languages are searched - * @language_tag: the tag of the language to find - * @language_index: (out) (optional): location to store the index of the language - * @required_feature_index: (out) (optional): location to store the - * required feature index of the language - * - * Finds the index of a language and its required feature index. - * - * If the language is not found, sets @language_index to %PANGO_OT_DEFAULT_LANGUAGE - * and the required feature of the default language system is returned in - * required_feature_index. For best compatibility with some fonts, also - * searches the language system tag 'dflt' before falling back to the default - * language system, but that is transparent to the user. The user can simply - * ignore the return value of this function to automatically fall back to the - * default language system. - * - * Return value: %TRUE if the language was found - */ -gboolean -pango_ot_info_find_language (PangoOTInfo *info, - PangoOTTableType table_type, - guint script_index, - PangoOTTag language_tag, - guint *language_index, - guint *required_feature_index) -{ - gboolean ret; - guint l_index; - hb_tag_t tt = get_hb_table_type (table_type); - - ret = hb_ot_layout_script_select_language (info->hb_face, - table_type, - script_index, - 1, - &language_tag, - &l_index); - if (language_index) - *language_index = l_index; - - hb_ot_layout_language_get_required_feature_index (info->hb_face, tt, - script_index, - l_index, - required_feature_index); - - return ret; -} - -/** - * pango_ot_info_find_feature: - * @info: a `PangoOTInfo` - * @table_type: the table type to obtain information about - * @feature_tag: the tag of the feature to find - * @script_index: the index of the script - * @language_index: the index of the language whose features are searched, - * or %PANGO_OT_DEFAULT_LANGUAGE to use the default language of the script - * @feature_index: (out) (optional): location to store the index of - * the feature - * - * Finds the index of a feature. - * - * If the feature is not found, sets @feature_index to PANGO_OT_NO_FEATURE, - * which is safe to pass to [method@PangoOT.Ruleset.add_feature] and similar - * functions. - * - * In the future, this may set @feature_index to an special value that if - * used in [method@PangoOT.Ruleset.add_feature] will ask Pango to synthesize - * the requested feature based on Unicode properties and data. However, this - * function will still return %FALSE in those cases. So, users may want to - * ignore the return value of this function in certain cases. - * - * Return value: %TRUE if the feature was found - */ -gboolean -pango_ot_info_find_feature (PangoOTInfo *info, - PangoOTTableType table_type, - PangoOTTag feature_tag, - guint script_index, - guint language_index, - guint *feature_index) -{ - hb_tag_t tt = get_hb_table_type (table_type); - - return hb_ot_layout_language_find_feature (info->hb_face, tt, - script_index, - language_index, - feature_tag, - feature_index); -} - -/** - * pango_ot_info_list_scripts: - * @info: a `PangoOTInfo` - * @table_type: the table type to obtain information about - * - * Obtains the list of available scripts. - * - * Return value: a newly-allocated zero-terminated - * array containing the tags of the available scripts - */ -PangoOTTag * -pango_ot_info_list_scripts (PangoOTInfo *info, - PangoOTTableType table_type) -{ - hb_tag_t tt = get_hb_table_type (table_type); - PangoOTTag *result; - unsigned int count; - - count = hb_ot_layout_table_get_script_tags (info->hb_face, tt, 0, NULL, NULL); - result = g_new (PangoOTTag, count + 1); - hb_ot_layout_table_get_script_tags (info->hb_face, tt, 0, &count, result); - result[count] = 0; - - return result; -} - -/** - * pango_ot_info_list_languages: - * @info: a `PangoOTInfo` - * @table_type: the table type to obtain information about - * @script_index: the index of the script to list languages for - * @language_tag: unused parameter - * - * Obtains the list of available languages for a given script. - * - * Return value: a newly-allocated zero-terminated - * array containing the tags of the available languages - */ -PangoOTTag * -pango_ot_info_list_languages (PangoOTInfo *info, - PangoOTTableType table_type, - guint script_index, - PangoOTTag language_tag G_GNUC_UNUSED) -{ - hb_tag_t tt = get_hb_table_type (table_type); - PangoOTTag *result; - unsigned int count; - - count = hb_ot_layout_script_get_language_tags (info->hb_face, tt, script_index, 0, NULL, NULL); - result = g_new (PangoOTTag, count + 1); - hb_ot_layout_script_get_language_tags (info->hb_face, tt, script_index, 0, &count, result); - result[count] = 0; - - return result; -} - -/** - * pango_ot_info_list_features: - * @info: a `PangoOTInfo` - * @table_type: the table type to obtain information about - * @tag: unused parameter - * @script_index: the index of the script to obtain information about - * @language_index: the index of the language to list features for, or - * %PANGO_OT_DEFAULT_LANGUAGE, to list features for the default - * language of the script - * - * Obtains the list of features for the given language of the given script. - * - * Return value: a newly-allocated zero-terminated - * array containing the tags of the available features - */ -PangoOTTag * -pango_ot_info_list_features (PangoOTInfo *info, - PangoOTTableType table_type, - PangoOTTag tag G_GNUC_UNUSED, - guint script_index, - guint language_index) -{ - hb_tag_t tt = get_hb_table_type (table_type); - PangoOTTag *result; - unsigned int count; - - count = hb_ot_layout_language_get_feature_tags (info->hb_face, tt, script_index, language_index, 0, NULL, NULL); - result = g_new (PangoOTTag, count + 1); - hb_ot_layout_language_get_feature_tags (info->hb_face, tt, script_index, language_index, 0, &count, result); - result[count] = 0; - - return result; -} diff --git a/pango/pango-ot-private.h b/pango/pango-ot-private.h deleted file mode 100644 index 9a88c3f4..00000000 --- a/pango/pango-ot-private.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Pango - * pango-ot-private.h: Implementation details for Pango OpenType code - * - * Copyright (C) 2000 Red Hat Software - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __PANGO_OT_PRIVATE_H__ -#define __PANGO_OT_PRIVATE_H__ - -#include <glib.h> -#include <glib-object.h> - -#include <pango/pango-ot.h> -#include <hb-ot.h> -#include <hb-ft.h> - -#include "pangofc-private.h" - -G_BEGIN_DECLS - -typedef struct _PangoOTInfoClass PangoOTInfoClass; - -/** - * PangoOTInfo: - * - * The `PangoOTInfo` struct contains the various - * tables associated with an OpenType font. It contains only private fields and - * should only be accessed via the pango_ot_info_… functions - * which are documented below. To obtain a `PangoOTInfo`, - * use pango_ot_info_get(). - */ -struct _PangoOTInfo -{ - GObject parent_instance; - - FT_Face face; - hb_face_t *hb_face; -}; - -struct _PangoOTInfoClass -{ - GObjectClass parent_class; -}; - - -typedef struct _PangoOTRulesetClass PangoOTRulesetClass; - -struct _PangoOTRuleset -{ - GObject parent_instance; -}; - -struct _PangoOTRulesetClass -{ - GObjectClass parent_class; -}; - -/** - * PangoOTBuffer: - * - * The `PangoOTBuffer` structure is used to store strings of glyphs associated - * with a `PangoFcFont`, suitable for OpenType layout processing. It contains - * only private fields and should only be accessed via the - * pango_ot_buffer_… functions which are documented below. - * To obtain a `PangoOTBuffer`, use pango_ot_buffer_new(). - */ -struct _PangoOTBuffer -{ - hb_buffer_t *buffer; -}; - -G_END_DECLS - -#endif /* __PANGO_OT_PRIVATE_H__ */ diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c deleted file mode 100644 index 0398d9e6..00000000 --- a/pango/pango-ot-ruleset.c +++ /dev/null @@ -1,407 +0,0 @@ -/* Pango - * pango-ot-ruleset.c: Shaping using OpenType features - * - * Copyright (C) 2000 Red Hat Software - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include "pango-ot-private.h" - -static void pango_ot_ruleset_finalize (GObject *object); - -/** - * PangoOTRuleset: - * - * The `PangoOTRuleset` structure holds a set of features selected - * from the tables in an OpenType font. - * - * A feature is an operation such as adjusting glyph positioning - * that should be applied to a text feature such as a certain - * type of accent. - * - * A `PangoOTRuleset` is created with [ctor@PangoOT.Ruleset.new], - * features are added to it with [method@PangoOT.Ruleset.add_feature], - * then it is applied to a `PangoGlyphString` with - * [method@PangoOT.Ruleset.position]. - */ -G_DEFINE_TYPE (PangoOTRuleset, pango_ot_ruleset, G_TYPE_OBJECT); - -static void -pango_ot_ruleset_class_init (PangoOTRulesetClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->finalize = pango_ot_ruleset_finalize; -} - -static void -pango_ot_ruleset_init (PangoOTRuleset *ruleset) -{ -} - -static void -pango_ot_ruleset_finalize (GObject *object) -{ - G_OBJECT_CLASS (pango_ot_ruleset_parent_class)->finalize (object); -} - -/** - * pango_ot_ruleset_get_for_description: - * @info: a `PangoOTInfo` - * @desc: a `PangoOTRulesetDescription` - * - * Returns a ruleset for the given OpenType info and ruleset - * description. - * - * Rulesets are created on demand using - * [ctor@PangoOT.Ruleset.new_from_description]. - * The returned ruleset should not be modified or destroyed. - * - * The static feature map members of @desc should be alive as - * long as @info is. - * - * Return value: the `PangoOTRuleset` for @desc. This object will have - * the same lifetime as @info. - * - * Since: 1.18 - */ -const PangoOTRuleset * -pango_ot_ruleset_get_for_description (PangoOTInfo *info, - const PangoOTRulesetDescription *desc) -{ - static PangoOTRuleset *ruleset; /* MT-safe */ - - if (g_once_init_enter (&ruleset)) - g_once_init_leave (&ruleset, g_object_new (PANGO_TYPE_OT_RULESET, NULL)); - - return ruleset; -} - -/** - * pango_ot_ruleset_new: - * @info: a `PangoOTInfo` - * - * Creates a new `PangoOTRuleset` for the given OpenType info. - * - * Return value: the newly allocated `PangoOTRuleset` - */ -PangoOTRuleset * -pango_ot_ruleset_new (PangoOTInfo *info) -{ - return g_object_new (PANGO_TYPE_OT_RULESET, NULL); -} - -/** - * pango_ot_ruleset_new_for: - * @info: a `PangoOTInfo` - * @script: a `PangoScript` - * @language: a `PangoLanguage` - * - * Creates a new `PangoOTRuleset` for the given OpenType info, script, and - * language. - * - * This function is part of a convenience scheme that highly simplifies - * using a `PangoOTRuleset` to represent features for a specific pair of script - * and language. So one can use this function passing in the script and - * language of interest, and later try to add features to the ruleset by just - * specifying the feature name or tag, without having to deal with finding - * script, language, or feature indices manually. - * - * In addition to what [ctor@PangoOT.Ruleset.new] does, this function will: - * - * * Find the `PangoOTTag` script and language tags associated with - * @script and @language using [func@PangoOT.tag_from_script] and - * [func@PangoOT.tag_from_language], - * - * * For each of table types %PANGO_OT_TABLE_GSUB and %PANGO_OT_TABLE_GPOS, - * find the script index of the script tag found and the language - * system index of the language tag found in that script system, using - * [method@PangoOT.Info.find_script] and [method@PangoOT.Info.find_language], - * - * * For found language-systems, if they have required feature index, - * add that feature to the ruleset using [method@PangoOT.Ruleset.add_feature], - * - * * Remember found script and language indices for both table types, - * and use them in future [method@PangoOT.Ruleset.maybe_add_feature] and - * [method@PangoOT.Ruleset.maybe_add_features]. - * - * Because of the way return values of [method@PangoOT.Info.find_script] and - * [method@PangoOT.Info.find_language] are ignored, this function automatically - * finds and uses the 'DFLT' script and the default language-system. - * - * Return value: the newly allocated `PangoOTRuleset` - * - * Since: 1.18 - */ -PangoOTRuleset * -pango_ot_ruleset_new_for (PangoOTInfo *info, - PangoScript script, - PangoLanguage *language) -{ - return g_object_new (PANGO_TYPE_OT_RULESET, NULL); -} - -/** - * pango_ot_ruleset_new_from_description: - * @info: a `PangoOTInfo` - * @desc: a `PangoOTRulesetDescription` - * - * Creates a new `PangoOTRuleset` for the given OpenType info and - * matching the given ruleset description. - * - * This is a convenience function that calls [ctor@PangoOT.Ruleset.new_for] - * and adds the static GSUB/GPOS features to the resulting ruleset, - * followed by adding other features to both GSUB and GPOS. - * - * The static feature map members of @desc should be alive as - * long as @info is. - * - * Return value: the newly allocated `PangoOTRuleset` - * - * Since: 1.18 - */ -PangoOTRuleset * -pango_ot_ruleset_new_from_description (PangoOTInfo *info, - const PangoOTRulesetDescription *desc) -{ - return g_object_new (PANGO_TYPE_OT_RULESET, NULL); -} - -/** - * pango_ot_ruleset_add_feature: - * @ruleset: a `PangoOTRuleset` - * @table_type: the table type to add a feature to - * @feature_index: the index of the feature to add - * @property_bit: the property bit to use for this feature. Used to - * identify the glyphs that this feature should be applied to, or - * %PANGO_OT_ALL_GLYPHS if it should be applied to all glyphs. - * - * Adds a feature to the ruleset. - */ -void -pango_ot_ruleset_add_feature (PangoOTRuleset *ruleset, - PangoOTTableType table_type, - guint feature_index, - gulong property_bit) -{ -} - -/** - * pango_ot_ruleset_maybe_add_feature: - * @ruleset: a `PangoOTRuleset` - * @table_type: the table type to add a feature to - * @feature_tag: the tag of the feature to add - * @property_bit: the property bit to use for this feature. Used to - * identify the glyphs that this feature should be applied to, or - * %PANGO_OT_ALL_GLYPHS if it should be applied to all glyphs. - * - * This is a convenience function that first tries to find the feature - * using [method@PangoOT.Info.find_feature] and the ruleset script and - * language passed to [ctor@PangoOT.Ruleset.new_for] and if the feature - * is found, adds it to the ruleset. - * - * If @ruleset was not created using [ctor@PangoOT.Ruleset.new_for], - * this function does nothing. - * - * Return value: %TRUE if the feature was found and added to ruleset, - * %FALSE otherwise - * - * Since: 1.18 - */ -gboolean -pango_ot_ruleset_maybe_add_feature (PangoOTRuleset *ruleset, - PangoOTTableType table_type, - PangoOTTag feature_tag, - gulong property_bit) -{ - return FALSE; -} - -/** - * pango_ot_ruleset_maybe_add_features: - * @ruleset: a `PangoOTRuleset` - * @table_type: the table type to add features to - * @features: array of feature name and property bits to add - * @n_features: number of feature records in @features array - * - * This is a convenience function that for each feature in the feature map - * array @features converts the feature name to a `PangoOTTag` feature tag - * using PANGO_OT_TAG_MAKE() and calls [method@PangoOT.Ruleset.maybe_add_feature] - * on it. - * - * Return value: The number of features in @features that were found - * and added to @ruleset - * - * Since: 1.18 - */ -guint -pango_ot_ruleset_maybe_add_features (PangoOTRuleset *ruleset, - PangoOTTableType table_type, - const PangoOTFeatureMap *features, - guint n_features) -{ - return 0; -} - -/** - * pango_ot_ruleset_get_feature_count: - * @ruleset: a `PangoOTRuleset` - * @n_gsub_features: (out) (optional): location to store number of GSUB features - * @n_gpos_features: (out) (optional): location to store number of GPOS features - * - * Gets the number of GSUB and GPOS features in the ruleset. - * - * Return value: Total number of features in the @ruleset - * - * Since: 1.18 - */ -guint -pango_ot_ruleset_get_feature_count (const PangoOTRuleset *ruleset, - guint *n_gsub_features, - guint *n_gpos_features) -{ - return 0; -} - -/** - * pango_ot_ruleset_substitute: - * @ruleset: a `PangoOTRuleset` - * @buffer: a `PangoOTBuffer` - * - * Performs the OpenType GSUB substitution on @buffer using - * the features in @ruleset. - * - * Since: 1.4 - */ -void -pango_ot_ruleset_substitute (const PangoOTRuleset *ruleset, - PangoOTBuffer *buffer) -{ -} - -/** - * pango_ot_ruleset_position: - * @ruleset: a `PangoOTRuleset` - * @buffer: a `PangoOTBuffer` - * - * Performs the OpenType GPOS positioning on @buffer using - * the features in @ruleset. - * - * Since: 1.4 - */ -void -pango_ot_ruleset_position (const PangoOTRuleset *ruleset, - PangoOTBuffer *buffer) -{ -} - - -/* ruleset descriptions */ - -/** - * pango_ot_ruleset_description_hash: - * @desc: a ruleset description - * - * Computes a hash of a `PangoOTRulesetDescription` structure suitable - * to be used, for example, as an argument to g_hash_table_new(). - * - * Return value: the hash value - * - * Since: 1.18 - */ -guint -pango_ot_ruleset_description_hash (const PangoOTRulesetDescription *desc) -{ - return 0; -} - -/** - * pango_ot_ruleset_description_equal: - * @desc1: a ruleset description - * @desc2: a ruleset description - * - * Compares two ruleset descriptions for equality. - * - * Two ruleset descriptions are considered equal if the rulesets - * they describe are provably identical. This means that their - * script, language, and all feature sets should be equal. - * - * For static feature sets, the array addresses are compared directly, - * while for other features, the list of features is compared one by - * one.(Two ruleset descriptions may result in identical rulesets - * being created, but still compare %FALSE.) - * - * Return value: %TRUE if two ruleset descriptions are identical, - * %FALSE otherwise - * - * Since: 1.18 - **/ -gboolean -pango_ot_ruleset_description_equal (const PangoOTRulesetDescription *desc1, - const PangoOTRulesetDescription *desc2) -{ - return TRUE; -} - -G_DEFINE_BOXED_TYPE (PangoOTRulesetDescription, pango_ot_ruleset_description, - pango_ot_ruleset_description_copy, - pango_ot_ruleset_description_free) - -/** - * pango_ot_ruleset_description_copy: - * @desc: ruleset description to copy - * - * Creates a copy of @desc, which should be freed with - * [method@PangoOT.RulesetDescription.free]. - * - * Primarily used internally by [func@PangoOT.Ruleset.get_for_description] - * to cache rulesets for ruleset descriptions. - * - * Return value: the newly allocated `PangoOTRulesetDescription` - * - * Since: 1.18 - */ -PangoOTRulesetDescription * -pango_ot_ruleset_description_copy (const PangoOTRulesetDescription *desc) -{ - PangoOTRulesetDescription *copy; - - g_return_val_if_fail (desc != NULL, NULL); - - copy = g_slice_new (PangoOTRulesetDescription); - - *copy = *desc; - - return copy; -} - -/** - * pango_ot_ruleset_description_free: - * @desc: an allocated `PangoOTRulesetDescription` - * - * Frees a ruleset description allocated by - * pango_ot_ruleset_description_copy(). - * - * Since: 1.18 - */ -void -pango_ot_ruleset_description_free (PangoOTRulesetDescription *desc) -{ - g_slice_free (PangoOTRulesetDescription, desc); -} diff --git a/pango/pango-ot-tag.c b/pango/pango-ot-tag.c deleted file mode 100644 index 65f9c89d..00000000 --- a/pango/pango-ot-tag.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Pango - * pango-ot-tag.h: - * - * Copyright (C) 2007 Red Hat Software - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include "pango-ot-private.h" - -/** - * pango_ot_tag_from_script: - * @script: A `PangoScript` - * - * Finds the OpenType script tag corresponding to @script. - * - * The %PANGO_SCRIPT_COMMON, %PANGO_SCRIPT_INHERITED, and - * %PANGO_SCRIPT_UNKNOWN scripts are mapped to the OpenType - * 'DFLT' script tag that is also defined as - * %PANGO_OT_TAG_DEFAULT_SCRIPT. - * - * Note that multiple `PangoScript` values may map to the same - * OpenType script tag. In particular, %PANGO_SCRIPT_HIRAGANA - * and %PANGO_SCRIPT_KATAKANA both map to the OT tag 'kana'. - * - * Return value: `PangoOTTag` corresponding to @script or - * %PANGO_OT_TAG_DEFAULT_SCRIPT if none found. - * - * Since: 1.18 - **/ -PangoOTTag -pango_ot_tag_from_script (PangoScript script) -{ - unsigned int count = 1; - hb_tag_t tags[1]; - - hb_ot_tags_from_script_and_language ((hb_script_t) g_unicode_script_to_iso15924 ((GUnicodeScript) script), - HB_LANGUAGE_INVALID, - &count, - tags, - NULL, NULL); - if (count > 0) - return (PangoOTTag) tags[0]; - - return PANGO_OT_TAG_DEFAULT_SCRIPT; -} - -/** - * pango_ot_tag_to_script: - * @script_tag: A `PangoOTTag` OpenType script tag - * - * Finds the `PangoScript` corresponding to @script_tag. - * - * The 'DFLT' script tag is mapped to %PANGO_SCRIPT_COMMON. - * - * Note that an OpenType script tag may correspond to multiple - * `PangoScript` values. In such cases, the `PangoScript` value - * with the smallest value is returned. - * In particular, %PANGO_SCRIPT_HIRAGANA - * and %PANGO_SCRIPT_KATAKANA both map to the OT tag 'kana'. - * This function will return %PANGO_SCRIPT_HIRAGANA for - * 'kana'. - * - * Return value: `PangoScript` corresponding to @script_tag or - * %PANGO_SCRIPT_UNKNOWN if none found. - * - * Since: 1.18 - **/ -PangoScript -pango_ot_tag_to_script (PangoOTTag script_tag) -{ - return (PangoScript) g_unicode_script_from_iso15924 (hb_ot_tag_to_script ((hb_tag_t) script_tag)); -} - - -/** - * pango_ot_tag_from_language: - * @language: (nullable): A `PangoLanguage` - * - * Finds the OpenType language-system tag best describing @language. - * - * Return value: `PangoOTTag` best matching @language or - * %PANGO_OT_TAG_DEFAULT_LANGUAGE if none found or if @language - * is %NULL. - * - * Since: 1.18 - **/ -PangoOTTag -pango_ot_tag_from_language (PangoLanguage *language) -{ - unsigned int count = 1; - hb_tag_t tags[1]; - - hb_ot_tags_from_script_and_language (HB_SCRIPT_UNKNOWN, - hb_language_from_string (pango_language_to_string (language), -1), - NULL, NULL, - &count, tags); - - if (count > 0) - return (PangoOTTag) tags[0]; - - return PANGO_OT_TAG_DEFAULT_LANGUAGE; -} - -/** - * pango_ot_tag_to_language: - * @language_tag: A `PangoOTTag` OpenType language-system tag - * - * Finds a `PangoLanguage` corresponding to @language_tag. - * - * Return value: `PangoLanguage` best matching @language_tag or - * `PangoLanguage` corresponding to the string "xx" if none found. - * - * Since: 1.18 - **/ -PangoLanguage * -pango_ot_tag_to_language (PangoOTTag language_tag) -{ - return pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language ((hb_tag_t) language_tag))); -} diff --git a/pango/pango-ot.h b/pango/pango-ot.h deleted file mode 100644 index 2d7b87c0..00000000 --- a/pango/pango-ot.h +++ /dev/null @@ -1,427 +0,0 @@ -/* Pango - * pango-ot.h: - * - * Copyright (C) 2000,2007 Red Hat Software - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __PANGO_OT_H__ -#define __PANGO_OT_H__ - -/* Deprecated. Use HarfBuzz directly! */ - -#include <pango/pangofc-font.h> -#include <pango/pango-glyph.h> -#include <pango/pango-font.h> -#include <pango/pango-script.h> -#include <pango/pango-language.h> - -#include <ft2build.h> -#include FT_FREETYPE_H - -G_BEGIN_DECLS - -#ifndef PANGO_DISABLE_DEPRECATED - -/** - * PangoOTTag: - * - * The `PangoOTTag` typedef is used to represent TrueType and OpenType - * four letter tags inside Pango. Use PANGO_OT_TAG_MAKE() - * or PANGO_OT_TAG_MAKE_FROM_STRING() macros to create PangoOTTags manually. - */ -typedef guint32 PangoOTTag; - -/** - * PANGO_OT_TAG_MAKE: - * @c1: First character. - * @c2: Second character. - * @c3: Third character. - * @c4: Fourth character. - * - * Creates a `PangoOTTag` from four characters. This is similar and - * compatible with the FT_MAKE_TAG() macro from FreeType. - */ -/** - * PANGO_OT_TAG_MAKE_FROM_STRING: - * @s: The string representation of the tag. - * - * Creates a `PangoOTTag` from a string. The string should be at least - * four characters long (pad with space characters if needed), and need - * not be nul-terminated. This is a convenience wrapper around - * PANGO_OT_TAG_MAKE(), but cannot be used in certain situations, for - * example, as a switch expression, as it dereferences pointers. - */ -#define PANGO_OT_TAG_MAKE(c1,c2,c3,c4) ((PangoOTTag) FT_MAKE_TAG (c1, c2, c3, c4)) -#define PANGO_OT_TAG_MAKE_FROM_STRING(s) (PANGO_OT_TAG_MAKE(((const char *) s)[0], \ - ((const char *) s)[1], \ - ((const char *) s)[2], \ - ((const char *) s)[3])) - -typedef struct _PangoOTInfo PangoOTInfo; -typedef struct _PangoOTBuffer PangoOTBuffer; -typedef struct _PangoOTGlyph PangoOTGlyph; -typedef struct _PangoOTRuleset PangoOTRuleset; -typedef struct _PangoOTFeatureMap PangoOTFeatureMap; -typedef struct _PangoOTRulesetDescription PangoOTRulesetDescription; - -/** - * PangoOTTableType: - * @PANGO_OT_TABLE_GSUB: The GSUB table. - * @PANGO_OT_TABLE_GPOS: The GPOS table. - * - * The PangoOTTableType enumeration values are used to - * identify the various OpenType tables in the - * pango_ot_info_… functions. - */ -typedef enum -{ - PANGO_OT_TABLE_GSUB, - PANGO_OT_TABLE_GPOS -} PangoOTTableType; - -/** - * PANGO_OT_ALL_GLYPHS: - * - * This is used as the property bit in pango_ot_ruleset_add_feature() when a - * feature should be applied to all glyphs. - * - * Since: 1.16 - */ -/** - * PANGO_OT_NO_FEATURE: - * - * This is used as a feature index that represent no feature, that is, should be - * skipped. It may be returned as feature index by pango_ot_info_find_feature() - * if the feature is not found, and pango_ot_ruleset_add_feature() function - * automatically skips this value, so no special handling is required by the user. - * - * Since: 1.18 - */ -/** - * PANGO_OT_NO_SCRIPT: - * - * This is used as a script index that represent no script, that is, when the - * requested script was not found, and a default ('DFLT') script was not found - * either. It may be returned as script index by pango_ot_info_find_script() - * if the script or a default script are not found, all other functions - * taking a script index essentially return if the input script index is - * this value, so no special handling is required by the user. - * - * Since: 1.18 - */ -/** - * PANGO_OT_DEFAULT_LANGUAGE: - * - * This is used as the language index in pango_ot_info_find_feature() when - * the default language system of the script is desired. - * - * It is also returned by pango_ot_info_find_language() if the requested language - * is not found, or the requested language tag was PANGO_OT_TAG_DEFAULT_LANGUAGE. - * The end result is that one can always call pango_ot_tag_from_language() - * followed by pango_ot_info_find_language() and pass the result to - * pango_ot_info_find_feature() without having to worry about falling back to - * default language system explicitly. - * - * Since: 1.16 - */ -#define PANGO_OT_ALL_GLYPHS ((guint) 0xFFFF) -#define PANGO_OT_NO_FEATURE ((guint) 0xFFFF) -#define PANGO_OT_NO_SCRIPT ((guint) 0xFFFF) -#define PANGO_OT_DEFAULT_LANGUAGE ((guint) 0xFFFF) - -/** - * PANGO_OT_TAG_DEFAULT_SCRIPT: - * - * This is a `PangoOTTag` representing the special script tag 'DFLT'. It is - * returned as script tag by pango_ot_tag_from_script() if the requested script - * is not found. - * - * Since: 1.18 - */ -/** - * PANGO_OT_TAG_DEFAULT_LANGUAGE: - * - * This is a `PangoOTTag` representing a special language tag 'dflt'. It is - * returned as language tag by pango_ot_tag_from_language() if the requested - * language is not found. It is safe to pass this value to - * pango_ot_info_find_language() as that function falls back to returning default - * language-system if the requested language tag is not found. - * - * Since: 1.18 - */ -#define PANGO_OT_TAG_DEFAULT_SCRIPT PANGO_OT_TAG_MAKE ('D', 'F', 'L', 'T') -#define PANGO_OT_TAG_DEFAULT_LANGUAGE PANGO_OT_TAG_MAKE ('d', 'f', 'l', 't') - -/* Note that this must match hb_glyph_info_t */ -/** - * PangoOTGlyph: - * @glyph: the glyph itself. - * @properties: the properties value, identifying which features should be - * applied on this glyph. See pango_ot_ruleset_add_feature(). - * @cluster: the cluster that this glyph belongs to. - * @component: a component value, set by the OpenType layout engine. - * @ligID: a ligature index value, set by the OpenType layout engine. - * @internal: for Pango internal use - * - * The `PangoOTGlyph` structure represents a single glyph together with - * information used for OpenType layout processing of the glyph. - * It contains the following fields. - */ -struct _PangoOTGlyph -{ - guint32 glyph; - guint properties; - guint cluster; - gushort component; - gushort ligID; - - guint internal; -}; - -/** - * PangoOTFeatureMap: - * @feature_name: feature tag in represented as four-letter ASCII string. - * @property_bit: the property bit to use for this feature. See - * pango_ot_ruleset_add_feature() for details. - * - * The `PangoOTFeatureMap` typedef is used to represent an OpenType - * feature with the property bit associated with it. The feature tag is - * represented as a char array instead of a `PangoOTTag` for convenience. - * - * Since: 1.18 - */ -struct _PangoOTFeatureMap -{ - char feature_name[5]; - gulong property_bit; -}; - -/** - * PangoOTRulesetDescription: - * @script: a `PangoScript` - * @language: a `PangoLanguage` - * @static_gsub_features: (nullable): static map of GSUB features - * @n_static_gsub_features: length of @static_gsub_features, or 0. - * @static_gpos_features: (nullable): static map of GPOS features - * @n_static_gpos_features: length of @static_gpos_features, or 0. - * @other_features: (nullable): map of extra features to add to both - * GSUB and GPOS. Unlike the static maps, this pointer need not - * live beyond the life of function calls taking this struct. - * @n_other_features: length of @other_features, or 0. - * - * The `PangoOTRuleset` structure holds all the information needed - * to build a complete `PangoOTRuleset` from an OpenType font. - * The main use of this struct is to act as the key for a per-font - * hash of rulesets. The user populates a ruleset description and - * gets the ruleset using pango_ot_ruleset_get_for_description() - * or create a new one using pango_ot_ruleset_new_from_description(). - * - * Since: 1.18 - */ -struct _PangoOTRulesetDescription { - PangoScript script; - PangoLanguage *language; - const PangoOTFeatureMap *static_gsub_features; - guint n_static_gsub_features; - const PangoOTFeatureMap *static_gpos_features; - guint n_static_gpos_features; - const PangoOTFeatureMap *other_features; - guint n_other_features; -}; - -#ifdef __GI_SCANNER__ -#define PANGO_OT_TYPE_INFO (pango_ot_info_get_type ()) -#define PANGO_OT_INFO(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_OT_TYPE_INFO, PangoOTInfo)) -#define PANGO_OT_IS_INFO(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_OT_TYPE_INFO)) -#else -#define PANGO_TYPE_OT_INFO (pango_ot_info_get_type ()) -#define PANGO_OT_INFO(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_OT_INFO, PangoOTInfo)) -#define PANGO_IS_OT_INFO(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_OT_INFO)) -#endif - -PANGO_DEPRECATED -GType pango_ot_info_get_type (void) G_GNUC_CONST; - -#ifdef __GI_SCANNER__ -#define PANGO_OT_TYPE_RULESET (pango_ot_ruleset_get_type ()) -#define PANGO_OT_RULESET(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_OT_TYPE_RULESET, PangoOTRuleset)) -#define PANGO_OT_IS_RULESET(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_OT_TYPE_RULESET)) -#else -#define PANGO_TYPE_OT_RULESET (pango_ot_ruleset_get_type ()) -#define PANGO_OT_RULESET(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_OT_RULESET, PangoOTRuleset)) -#define PANGO_IS_OT_RULESET(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_OT_RULESET)) -#endif - -PANGO_DEPRECATED -GType pango_ot_ruleset_get_type (void) G_GNUC_CONST; - - -PANGO_DEPRECATED -PangoOTInfo *pango_ot_info_get (FT_Face face); - -PANGO_DEPRECATED -gboolean pango_ot_info_find_script (PangoOTInfo *info, - PangoOTTableType table_type, - PangoOTTag script_tag, - guint *script_index); - -PANGO_DEPRECATED -gboolean pango_ot_info_find_language (PangoOTInfo *info, - PangoOTTableType table_type, - guint script_index, - PangoOTTag language_tag, - guint *language_index, - guint *required_feature_index); -PANGO_DEPRECATED -gboolean pango_ot_info_find_feature (PangoOTInfo *info, - PangoOTTableType table_type, - PangoOTTag feature_tag, - guint script_index, - guint language_index, - guint *feature_index); - -PANGO_DEPRECATED -PangoOTTag *pango_ot_info_list_scripts (PangoOTInfo *info, - PangoOTTableType table_type); -PANGO_DEPRECATED -PangoOTTag *pango_ot_info_list_languages (PangoOTInfo *info, - PangoOTTableType table_type, - guint script_index, - PangoOTTag language_tag); -PANGO_DEPRECATED -PangoOTTag *pango_ot_info_list_features (PangoOTInfo *info, - PangoOTTableType table_type, - PangoOTTag tag, - guint script_index, - guint language_index); - -#ifdef __GI_SCANNER__ -#define PANGO_OT_TYPE_BUFFER (pango_ot_buffer_get_type()) -#else -#define PANGO_TYPE_OT_BUFFER (pango_ot_buffer_get_type()) -#endif - -PANGO_DEPRECATED -GType pango_ot_buffer_get_type (void) G_GNUC_CONST; - -PANGO_DEPRECATED -PangoOTBuffer *pango_ot_buffer_new (PangoFcFont *font); -PANGO_DEPRECATED -void pango_ot_buffer_destroy (PangoOTBuffer *buffer); -PANGO_DEPRECATED -void pango_ot_buffer_clear (PangoOTBuffer *buffer); -PANGO_DEPRECATED -void pango_ot_buffer_set_rtl (PangoOTBuffer *buffer, - gboolean rtl); -PANGO_DEPRECATED -void pango_ot_buffer_add_glyph (PangoOTBuffer *buffer, - guint glyph, - guint properties, - guint cluster); -PANGO_DEPRECATED -void pango_ot_buffer_get_glyphs (const PangoOTBuffer *buffer, - PangoOTGlyph **glyphs, - int *n_glyphs); -PANGO_DEPRECATED -void pango_ot_buffer_output (const PangoOTBuffer *buffer, - PangoGlyphString *glyphs); - -PANGO_DEPRECATED -void pango_ot_buffer_set_zero_width_marks (PangoOTBuffer *buffer, - gboolean zero_width_marks); - -PANGO_DEPRECATED -const PangoOTRuleset *pango_ot_ruleset_get_for_description (PangoOTInfo *info, - const PangoOTRulesetDescription *desc); -PANGO_DEPRECATED -PangoOTRuleset *pango_ot_ruleset_new (PangoOTInfo *info); -PANGO_DEPRECATED -PangoOTRuleset *pango_ot_ruleset_new_for (PangoOTInfo *info, - PangoScript script, - PangoLanguage *language); -PANGO_DEPRECATED -PangoOTRuleset *pango_ot_ruleset_new_from_description (PangoOTInfo *info, - const PangoOTRulesetDescription *desc); -PANGO_DEPRECATED -void pango_ot_ruleset_add_feature (PangoOTRuleset *ruleset, - PangoOTTableType table_type, - guint feature_index, - gulong property_bit); -PANGO_DEPRECATED -gboolean pango_ot_ruleset_maybe_add_feature (PangoOTRuleset *ruleset, - PangoOTTableType table_type, - PangoOTTag feature_tag, - gulong property_bit); -PANGO_DEPRECATED -guint pango_ot_ruleset_maybe_add_features (PangoOTRuleset *ruleset, - PangoOTTableType table_type, - const PangoOTFeatureMap *features, - guint n_features); -PANGO_DEPRECATED -guint pango_ot_ruleset_get_feature_count (const PangoOTRuleset *ruleset, - guint *n_gsub_features, - guint *n_gpos_features); - -PANGO_DEPRECATED -void pango_ot_ruleset_substitute (const PangoOTRuleset *ruleset, - PangoOTBuffer *buffer); - -PANGO_DEPRECATED -void pango_ot_ruleset_position (const PangoOTRuleset *ruleset, - PangoOTBuffer *buffer); - -PANGO_DEPRECATED -PangoScript pango_ot_tag_to_script (PangoOTTag script_tag) G_GNUC_CONST; - -PANGO_DEPRECATED -PangoOTTag pango_ot_tag_from_script (PangoScript script) G_GNUC_CONST; - -PANGO_DEPRECATED -PangoLanguage *pango_ot_tag_to_language (PangoOTTag language_tag) G_GNUC_CONST; - -PANGO_DEPRECATED -PangoOTTag pango_ot_tag_from_language (PangoLanguage *language) G_GNUC_CONST; - -#ifdef __GI_SCANNER__ -#define PANGO_OT_TYPE_RULESET_DESCRIPTION (pango_ot_ruleset_description_get_type()) -#else -#define PANGO_TYPE_OT_RULESET_DESCRIPTION (pango_ot_ruleset_description_get_type()) -#endif - -PANGO_DEPRECATED -GType pango_ot_ruleset_description_get_type (void) G_GNUC_CONST; - -PANGO_DEPRECATED -guint pango_ot_ruleset_description_hash (const PangoOTRulesetDescription *desc) G_GNUC_PURE; - -PANGO_DEPRECATED -gboolean pango_ot_ruleset_description_equal (const PangoOTRulesetDescription *desc1, - const PangoOTRulesetDescription *desc2) G_GNUC_PURE; - -PANGO_DEPRECATED -PangoOTRulesetDescription *pango_ot_ruleset_description_copy (const PangoOTRulesetDescription *desc); - -PANGO_DEPRECATED -void pango_ot_ruleset_description_free (PangoOTRulesetDescription *desc); - - -#endif /* PANGO_DISABLE_DEPRECATED */ - -G_END_DECLS - -#endif /* __PANGO_OT_H__ */ diff --git a/tests/testmisc.c b/tests/testmisc.c index 1aa90948..c1eadc58 100644 --- a/tests/testmisc.c +++ b/tests/testmisc.c @@ -23,10 +23,6 @@ #include <glib.h> #include <pango/pangocairo.h> -#ifdef HAVE_CAIRO_FREETYPE -#include <pango/pango-ot.h> -#endif - /* test that we don't crash in shape_tab when the layout * is such that we don't have effective attributes */ @@ -388,28 +384,6 @@ test_gravity_for_script (void) } } -#ifdef HAVE_CAIRO_FREETYPE -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - -static void -test_language_to_tag (void) -{ - PangoLanguage *lang; - PangoOTTag tag; - PangoLanguage *lang2; - - lang = pango_language_from_string ("de"); - - tag = pango_ot_tag_from_language (lang); - - lang2 = pango_ot_tag_to_language (tag); - - g_assert_true (lang2 == lang); -} - -G_GNUC_END_IGNORE_DEPRECATIONS -#endif - static void test_fallback_shape (void) { @@ -841,9 +815,6 @@ main (int argc, char *argv[]) g_test_add_func ("/gravity/from-matrix", test_gravity_from_matrix); g_test_add_func ("/gravity/for-script", test_gravity_for_script); g_test_add_func ("/layout/fallback-shape", test_fallback_shape); -#ifdef HAVE_CAIRO_FREETYPE - g_test_add_func ("/language/to-tag", test_language_to_tag); -#endif g_test_add_func ("/bidi/get-cursor-crash", test_get_cursor_crash); g_test_add_func ("/bidi/get-cursor", test_get_cursor); g_test_add_func ("/layout/index-to-x", test_index_to_x); |