summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-20 15:59:59 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-20 16:01:14 -0400
commitd4c27984d66867d5dd8f9e7a1063400b38487a39 (patch)
tree0b5a848872bfa8a8ff9942641d0960df7b097989
parentd30a2677bdc931cb3836a9b0d3b0b1c2a5952529 (diff)
downloadpango-d4c27984d66867d5dd8f9e7a1063400b38487a39.tar.gz
Cosmetics
Streamline the internals of shape.c a bit.
-rw-r--r--pango/pangohb-private.h41
-rw-r--r--pango/shape.c34
2 files changed, 17 insertions, 58 deletions
diff --git a/pango/pangohb-private.h b/pango/pangohb-private.h
deleted file mode 100644
index 217bdb28..00000000
--- a/pango/pangohb-private.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Pango
- * pangohb-private.h: Private routines for using harfbuzz
- *
- * Copyright (C) 2019 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 __PANGOHB_PRIVATE_H__
-#define __PANGOHB_PRIVATE_H__
-
-#include <pango-font.h>
-#include <pango-item.h>
-#include <pango-glyph.h>
-
-G_BEGIN_DECLS
-
-void pango_hb_shape (PangoFont *font,
- const char *item_text,
- unsigned int item_length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- const char *paragraph_text,
- unsigned int paragraph_length);
-
-G_END_DECLS
-
-#endif /* __PANGOHB_PRIVATE_H__ */
diff --git a/pango/shape.c b/pango/shape.c
index f10bd5c9..8743fad3 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -28,7 +28,6 @@
#include "pango-impl-utils.h"
#include "pango-glyph.h"
-#include "pangohb-private.h"
#include "pango-font-private.h"
/* {{{ Harfbuzz shaping */
@@ -319,14 +318,14 @@ find_show_flags (const PangoAnalysis *analysis)
}
/* }}}} */
-void
-pango_hb_shape (PangoFont *font,
- const char *item_text,
- unsigned int item_length,
+static void
+pango_hb_shape (const char *item_text,
+ int item_length,
+ const char *paragraph_text,
+ int paragraph_length,
const PangoAnalysis *analysis,
PangoGlyphString *glyphs,
- const char *paragraph_text,
- unsigned int paragraph_length)
+ PangoShapeFlags flags)
{
PangoHbShapeContext context = { 0, };
hb_buffer_flags_t hb_buffer_flags;
@@ -343,11 +342,11 @@ pango_hb_shape (PangoFont *font,
unsigned int num_features = 0;
PangoGlyphInfo *infos;
- g_return_if_fail (font != NULL);
g_return_if_fail (analysis != NULL);
+ g_return_if_fail (analysis->font != NULL);
context.show_flags = find_show_flags (analysis);
- hb_font = pango_font_get_hb_font_for_context (font, &context);
+ hb_font = pango_font_get_hb_font_for_context (analysis->font, &context);
hb_buffer = acquire_buffer (&free_buffer);
hb_direction = PANGO_GRAVITY_IS_VERTICAL (analysis->gravity) ? HB_DIRECTION_TTB : HB_DIRECTION_LTR;
@@ -386,7 +385,7 @@ pango_hb_shape (PangoFont *font,
hb_buffer_add (hb_buffer, '-', item_offset + item_length - last_char_len);
}
- pango_font_get_features (font, features, G_N_ELEMENTS (features), &num_features);
+ pango_font_get_features (analysis->font, features, G_N_ELEMENTS (features), &num_features);
apply_extra_attributes (analysis->extra_attrs, features, G_N_ELEMENTS (features), &num_features);
hb_shape (hb_font, hb_buffer, features, num_features);
@@ -594,9 +593,9 @@ pango_shape_full (const char *item_text,
* Since: 1.44
*/
void
-pango_shape_with_flags (const char *item_text,
- int item_length,
- const char *paragraph_text,
+pango_shape_with_flags (const char *item_text,
+ int item_length,
+ const char *paragraph_text,
int paragraph_length,
const PangoAnalysis *analysis,
PangoGlyphString *glyphs,
@@ -623,10 +622,11 @@ pango_shape_with_flags (const char *item_text,
if (analysis->font)
{
- pango_hb_shape (analysis->font,
- item_text, item_length,
- analysis, glyphs,
- paragraph_text, paragraph_length);
+ pango_hb_shape (item_text, item_length,
+ paragraph_text, paragraph_length,
+ analysis,
+ glyphs,
+ flags);
if (G_UNLIKELY (glyphs->num_glyphs == 0))
{