2009-07-29 16:21:07 +00:00
|
|
|
/*
|
2012-05-10 11:16:03 +00:00
|
|
|
* Cogl
|
2009-07-29 16:21:07 +00:00
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* A Low Level GPU Graphics and Utilities API
|
2009-07-29 16:21:07 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2008 OpenedHand
|
2012-05-10 11:16:03 +00:00
|
|
|
* Copyright (C) 2012 Intel Corporation.
|
2009-07-29 16:21:07 +00:00
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use, copy,
|
|
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
|
|
* of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2009-07-29 16:21:07 +00:00
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
2009-07-29 16:21:07 +00:00
|
|
|
*
|
2014-02-22 01:28:54 +00:00
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
2012-05-10 11:16:03 +00:00
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Neil Roberts <neil@linux.intel.com>
|
|
|
|
* Robert Bragg <robert@linux.intel.com>
|
|
|
|
* Matthew Allum <mallum@openedhand.com>
|
2009-07-29 16:21:07 +00:00
|
|
|
*/
|
|
|
|
|
2023-07-21 13:37:20 +00:00
|
|
|
#pragma once
|
2009-07-29 16:21:07 +00:00
|
|
|
|
|
|
|
#include <glib-object.h>
|
|
|
|
#include <pango/pango.h>
|
|
|
|
#include <pango/pangocairo.h>
|
2013-10-09 12:31:12 +00:00
|
|
|
|
|
|
|
/* XXX: Currently this header may be included both as an internal
|
|
|
|
* header (within the cogl-pango implementation) and as a public
|
|
|
|
* header.
|
|
|
|
*
|
|
|
|
* Since <cogl/cogl.h> should not be included for internal use we
|
|
|
|
* determine the current context and switch between including cogl.h
|
|
|
|
* or specific internal cogl headers here...
|
|
|
|
*/
|
|
|
|
#ifndef COGL_COMPILATION
|
2023-08-07 13:38:12 +00:00
|
|
|
#include "cogl/cogl.h"
|
2013-10-09 12:31:12 +00:00
|
|
|
#else
|
|
|
|
#include "cogl/cogl-context.h"
|
2016-06-15 19:57:36 +00:00
|
|
|
#include "cogl/cogl-macros.h"
|
2013-10-09 12:31:12 +00:00
|
|
|
#endif
|
2009-07-29 16:21:07 +00:00
|
|
|
|
2018-11-23 07:42:05 +00:00
|
|
|
G_BEGIN_DECLS
|
2009-07-29 16:21:07 +00:00
|
|
|
|
|
|
|
/* It's too difficult to actually subclass the pango cairo font
|
|
|
|
* map. Instead we just make a fake set of macros that actually just
|
|
|
|
* directly use the original type
|
|
|
|
*/
|
|
|
|
#define COGL_PANGO_TYPE_FONT_MAP PANGO_TYPE_CAIRO_FONT_MAP
|
|
|
|
#define COGL_PANGO_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COGL_PANGO_TYPE_FONT_MAP, CoglPangoFontMap))
|
|
|
|
#define COGL_PANGO_IS_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COGL_PANGO_TYPE_FONT_MAP))
|
|
|
|
|
|
|
|
typedef PangoCairoFontMap CoglPangoFontMap;
|
|
|
|
|
2012-05-10 11:16:03 +00:00
|
|
|
/**
|
|
|
|
* cogl_pango_font_map_new:
|
|
|
|
*
|
|
|
|
* Creates a new font map.
|
|
|
|
*
|
|
|
|
* Return value: (transfer full): the newly created #PangoFontMap
|
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT PangoFontMap *
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_font_map_new (void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_pango_font_map_create_context:
|
|
|
|
* @font_map: a #CoglPangoFontMap
|
|
|
|
*
|
2022-11-22 11:54:04 +00:00
|
|
|
* Create a [class@Pango.Context] for the given @font_map.
|
2012-05-10 11:16:03 +00:00
|
|
|
*
|
2022-11-22 11:54:04 +00:00
|
|
|
* Returns: (transfer full): the newly created context: free with [method@GObject.Object.unref].
|
2012-05-10 11:16:03 +00:00
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT PangoContext *
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_font_map_create_context (CoglPangoFontMap *font_map);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_pango_font_map_set_resolution:
|
|
|
|
* @font_map: a #CoglPangoFontMap
|
|
|
|
* @dpi: The resolution in "dots per inch". (Physical inches aren't
|
|
|
|
* actually involved; the terminology is conventional.)
|
|
|
|
*
|
2022-11-22 11:54:04 +00:00
|
|
|
* Sets the resolution for the @font_map.
|
|
|
|
*
|
|
|
|
* This is a scale factor between points specified in a
|
|
|
|
* [struct@Pango.FontDescription] and Cogl units.
|
2012-05-10 11:16:03 +00:00
|
|
|
* The default value is %96, meaning that a 10 point font will be 13
|
|
|
|
* units high. (10 * 96. / 72. = 13.3).
|
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT void
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_font_map_set_resolution (CoglPangoFontMap *font_map,
|
|
|
|
double dpi);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_pango_font_map_clear_glyph_cache:
|
|
|
|
* @font_map: a #CoglPangoFontMap
|
|
|
|
*
|
|
|
|
* Clears the glyph cache for @font_map.
|
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT void
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_font_map_clear_glyph_cache (CoglPangoFontMap *font_map);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_pango_ensure_glyph_cache_for_layout:
|
|
|
|
* @layout: A #PangoLayout
|
|
|
|
*
|
|
|
|
* This updates any internal glyph cache textures as necessary to be
|
|
|
|
* able to render the given @layout.
|
|
|
|
*
|
|
|
|
* This api should be used to avoid mid-scene modifications of
|
|
|
|
* glyph-cache textures which can lead to undefined rendering results.
|
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT void
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_ensure_glyph_cache_for_layout (PangoLayout *layout);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_pango_font_map_set_use_mipmapping:
|
|
|
|
* @font_map: a #CoglPangoFontMap
|
|
|
|
* @value: %TRUE to enable the use of mipmapping
|
|
|
|
*
|
|
|
|
* Sets whether the renderer for the passed font map should use
|
2022-11-22 11:54:04 +00:00
|
|
|
* mipmapping when rendering a [class@Pango.Layout].
|
2012-05-10 11:16:03 +00:00
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT void
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_font_map_set_use_mipmapping (CoglPangoFontMap *font_map,
|
2018-11-24 12:04:47 +00:00
|
|
|
gboolean value);
|
2012-05-10 11:16:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_pango_font_map_get_use_mipmapping:
|
|
|
|
* @font_map: a #CoglPangoFontMap
|
|
|
|
*
|
2022-11-22 11:54:04 +00:00
|
|
|
* Retrieves whether the [class@CoglPango.Renderer] used by @font_map will use
|
2012-05-10 11:16:03 +00:00
|
|
|
* mipmapping when rendering the glyphs.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if mipmapping is used, %FALSE otherwise.
|
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT gboolean
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_font_map_get_use_mipmapping (CoglPangoFontMap *font_map);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_pango_font_map_get_renderer:
|
|
|
|
* @font_map: a #CoglPangoFontMap
|
|
|
|
*
|
2022-11-22 11:54:04 +00:00
|
|
|
* Retrieves the [class@CoglPango.Renderer] for the passed @font_map.
|
2012-05-10 11:16:03 +00:00
|
|
|
*
|
|
|
|
* Return value: (transfer none): a #PangoRenderer
|
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT PangoRenderer *
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_font_map_get_renderer (CoglPangoFontMap *font_map);
|
|
|
|
|
|
|
|
/**
|
2016-06-16 19:04:40 +00:00
|
|
|
* cogl_pango_show_layout: (skip)
|
2012-05-10 11:16:03 +00:00
|
|
|
* @framebuffer: A #CoglFramebuffer to draw too.
|
|
|
|
* @layout: a #PangoLayout
|
|
|
|
* @x: X coordinate to render the layout at
|
|
|
|
* @y: Y coordinate to render the layout at
|
|
|
|
* @color: color to use when rendering the layout
|
|
|
|
*
|
|
|
|
* Draws a solidly coloured @layout on the given @framebuffer at (@x,
|
2022-11-22 11:54:04 +00:00
|
|
|
* @y) within the `framebuffer`'s current model-view coordinate space.
|
2012-05-10 11:16:03 +00:00
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT void
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_show_layout (CoglFramebuffer *framebuffer,
|
|
|
|
PangoLayout *layout,
|
|
|
|
float x,
|
|
|
|
float y,
|
|
|
|
const CoglColor *color);
|
|
|
|
|
|
|
|
/**
|
2016-06-16 19:04:40 +00:00
|
|
|
* cogl_pango_show_layout_line: (skip)
|
2012-05-10 11:16:03 +00:00
|
|
|
* @framebuffer: A #CoglFramebuffer to draw too.
|
|
|
|
* @line: a #PangoLayoutLine
|
|
|
|
* @x: X coordinate to render the line at
|
|
|
|
* @y: Y coordinate to render the line at
|
|
|
|
* @color: color to use when rendering the line
|
|
|
|
*
|
|
|
|
* Draws a solidly coloured @line on the given @framebuffer at (@x,
|
2022-11-22 11:54:04 +00:00
|
|
|
* @y) within the `framebuffer`'s current model-view coordinate space.
|
2012-05-10 11:16:03 +00:00
|
|
|
*/
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT void
|
2012-05-10 11:16:03 +00:00
|
|
|
cogl_pango_show_layout_line (CoglFramebuffer *framebuffer,
|
|
|
|
PangoLayoutLine *line,
|
|
|
|
float x,
|
|
|
|
float y,
|
|
|
|
const CoglColor *color);
|
|
|
|
|
2009-07-29 16:21:07 +00:00
|
|
|
|
|
|
|
#define COGL_PANGO_TYPE_RENDERER (cogl_pango_renderer_get_type ())
|
2012-05-10 11:16:03 +00:00
|
|
|
#define COGL_PANGO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COGL_PANGO_TYPE_RENDERER, CoglPangoRenderer))
|
2009-07-29 16:21:07 +00:00
|
|
|
#define COGL_PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), COGL_PANGO_TYPE_RENDERER, CoglPangoRendererClass))
|
|
|
|
#define COGL_PANGO_IS_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), COGL_PANGO_TYPE_RENDERER))
|
|
|
|
#define COGL_PANGO_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), COGL_PANGO_TYPE_RENDERER))
|
|
|
|
#define COGL_PANGO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), COGL_PANGO_TYPE_RENDERER, CoglPangoRendererClass))
|
|
|
|
|
|
|
|
/* opaque types */
|
|
|
|
typedef struct _CoglPangoRenderer CoglPangoRenderer;
|
|
|
|
typedef struct _CoglPangoRendererClass CoglPangoRendererClass;
|
|
|
|
|
2019-11-21 11:15:22 +00:00
|
|
|
COGL_EXPORT GType cogl_pango_renderer_get_type (void) G_GNUC_CONST;
|
2009-07-29 16:21:07 +00:00
|
|
|
|
2018-11-23 07:42:05 +00:00
|
|
|
G_END_DECLS
|