[draw] Move hb_font_draw_glyph() to hb-draw-glyph.cc
This commit is contained in:
parent
9a1508a2be
commit
ddc36df332
|
@ -38,6 +38,7 @@ HB_BASE_sources = \
|
||||||
hb-config.hh \
|
hb-config.hh \
|
||||||
hb-debug.hh \
|
hb-debug.hh \
|
||||||
hb-dispatch.hh \
|
hb-dispatch.hh \
|
||||||
|
hb-draw-glyph.cc \
|
||||||
hb-draw.cc \
|
hb-draw.cc \
|
||||||
hb-draw.hh \
|
hb-draw.hh \
|
||||||
hb-face.cc \
|
hb-face.cc \
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* Copyright © 2019-2020 Ebrahim Byagowi
|
||||||
|
*
|
||||||
|
* This is part of HarfBuzz, a text shaping library.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, without written agreement and without
|
||||||
|
* license or royalty fees, to use, copy, modify, and distribute this
|
||||||
|
* software and its documentation for any purpose, provided that the
|
||||||
|
* above copyright notice and the following two paragraphs appear in
|
||||||
|
* all copies of this software.
|
||||||
|
*
|
||||||
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||||
|
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||||
|
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
* DAMAGE.
|
||||||
|
*
|
||||||
|
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||||
|
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||||
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "hb.hh"
|
||||||
|
|
||||||
|
#ifndef HB_NO_DRAW
|
||||||
|
|
||||||
|
#include "hb-ot-glyf-table.hh"
|
||||||
|
#include "hb-ot-cff1-table.hh"
|
||||||
|
#include "hb-ot-cff2-table.hh"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* hb_font_draw_glyph:
|
||||||
|
* @font: a font object
|
||||||
|
* @glyph: a glyph id
|
||||||
|
* @funcs: draw callbacks object
|
||||||
|
* @user_data: parameter you like be passed to the callbacks when are called
|
||||||
|
*
|
||||||
|
* Draw a glyph.
|
||||||
|
*
|
||||||
|
* Returns: Whether the font had the glyph and the operation completed successfully.
|
||||||
|
* Since: REPLACEME
|
||||||
|
**/
|
||||||
|
hb_bool_t
|
||||||
|
hb_font_draw_glyph (hb_font_t *font, hb_codepoint_t glyph,
|
||||||
|
const hb_draw_funcs_t *funcs,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
if (unlikely (funcs == &Null (hb_draw_funcs_t) ||
|
||||||
|
glyph >= font->face->get_num_glyphs ()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
draw_helper_t draw_helper (funcs, user_data);
|
||||||
|
if (font->face->table.glyf->get_path (font, glyph, draw_helper)) return true;
|
||||||
|
#ifndef HB_NO_CFF
|
||||||
|
if (font->face->table.cff1->get_path (font, glyph, draw_helper)) return true;
|
||||||
|
if (font->face->table.cff2->get_path (font, glyph, draw_helper)) return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -27,10 +27,6 @@
|
||||||
#ifndef HB_NO_DRAW
|
#ifndef HB_NO_DRAW
|
||||||
|
|
||||||
#include "hb-draw.hh"
|
#include "hb-draw.hh"
|
||||||
#include "hb-ot.h"
|
|
||||||
#include "hb-ot-glyf-table.hh"
|
|
||||||
#include "hb-ot-cff1-table.hh"
|
|
||||||
#include "hb-ot-cff2-table.hh"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hb_draw_funcs_set_move_to_func:
|
* hb_draw_funcs_set_move_to_func:
|
||||||
|
@ -225,35 +221,4 @@ hb_draw_funcs_is_immutable (hb_draw_funcs_t *funcs)
|
||||||
return hb_object_is_immutable (funcs);
|
return hb_object_is_immutable (funcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* hb_font_draw_glyph:
|
|
||||||
* @font: a font object
|
|
||||||
* @glyph: a glyph id
|
|
||||||
* @funcs: draw callbacks object
|
|
||||||
* @user_data: parameter you like be passed to the callbacks when are called
|
|
||||||
*
|
|
||||||
* Draw a glyph.
|
|
||||||
*
|
|
||||||
* Returns: Whether the font had the glyph and the operation completed successfully.
|
|
||||||
* Since: REPLACEME
|
|
||||||
**/
|
|
||||||
hb_bool_t
|
|
||||||
hb_font_draw_glyph (hb_font_t *font, hb_codepoint_t glyph,
|
|
||||||
const hb_draw_funcs_t *funcs,
|
|
||||||
void *user_data)
|
|
||||||
{
|
|
||||||
if (unlikely (funcs == &Null (hb_draw_funcs_t) ||
|
|
||||||
glyph >= font->face->get_num_glyphs ()))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
draw_helper_t draw_helper (funcs, user_data);
|
|
||||||
if (font->face->table.glyf->get_path (font, glyph, draw_helper)) return true;
|
|
||||||
#ifndef HB_NO_CFF
|
|
||||||
if (font->face->table.cff1->get_path (font, glyph, draw_helper)) return true;
|
|
||||||
if (font->face->table.cff2->get_path (font, glyph, draw_helper)) return true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,7 @@ hb_base_sources = files(
|
||||||
'hb-config.hh',
|
'hb-config.hh',
|
||||||
'hb-debug.hh',
|
'hb-debug.hh',
|
||||||
'hb-dispatch.hh',
|
'hb-dispatch.hh',
|
||||||
|
'hb-draw-glyph.cc',
|
||||||
'hb-draw.cc',
|
'hb-draw.cc',
|
||||||
'hb-draw.hh',
|
'hb-draw.hh',
|
||||||
'hb-face.cc',
|
'hb-face.cc',
|
||||||
|
|
Loading…
Reference in New Issue