mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 23:11:04 +01:00
[vector] Merge hb-vector-buf.cc into hb-vector.cc
The decimal point helper was the only content in the separate .cc file. Move it into hb-vector.cc and remove the extra compilation unit. Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
aa09dd51d1
commit
d77a910d8e
5 files changed
+92
-95
No files matched your search
@@ -263,7 +263,6 @@ set (vector_project_sources
|
||||
${PROJECT_SOURCE_DIR}/src/hb-vector-paint-svg.cc
|
||||
${PROJECT_SOURCE_DIR}/src/hb-vector-paint-pdf.cc
|
||||
${PROJECT_SOURCE_DIR}/src/hb-vector-path.hh
|
||||
${PROJECT_SOURCE_DIR}/src/hb-vector-buf.cc
|
||||
${PROJECT_SOURCE_DIR}/src/hb-vector-buf.hh
|
||||
${PROJECT_SOURCE_DIR}/src/hb-static.cc
|
||||
)
|
||||
|
||||
@@ -153,7 +153,6 @@
|
||||
|
||||
#ifdef HB_HAS_VECTOR
|
||||
#include "hb-static.cc"
|
||||
#include "hb-vector-buf.cc"
|
||||
#include "hb-vector-draw.cc"
|
||||
#include "hb-vector-paint-pdf.cc"
|
||||
#include "hb-vector-paint-svg.cc"
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2026 Behdad Esfahbod
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#include "hb-machinery.hh"
|
||||
#include "hb-vector-buf.hh"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
struct hb_vector_decimal_point_t
|
||||
{
|
||||
char value[8];
|
||||
};
|
||||
|
||||
static hb_vector_decimal_point_t hb_vector_decimal_point_default = {{'.', '\0'}};
|
||||
|
||||
static inline void free_static_svg_decimal_point ();
|
||||
|
||||
static struct hb_vector_decimal_point_lazy_loader_t
|
||||
: hb_lazy_loader_t<hb_vector_decimal_point_t, hb_vector_decimal_point_lazy_loader_t>
|
||||
{
|
||||
static hb_vector_decimal_point_t *create ()
|
||||
{
|
||||
auto *p = (hb_vector_decimal_point_t *) hb_calloc (1, sizeof (hb_vector_decimal_point_t));
|
||||
if (!p)
|
||||
return nullptr;
|
||||
|
||||
p->value[0] = '.';
|
||||
p->value[1] = '\0';
|
||||
|
||||
#ifndef HB_NO_SETLOCALE
|
||||
lconv *lc = nullptr;
|
||||
#ifdef HAVE_LOCALECONV_L
|
||||
hb_locale_t current_locale = hb_uselocale ((hb_locale_t) 0);
|
||||
if (current_locale)
|
||||
lc = localeconv_l (current_locale);
|
||||
#endif
|
||||
if (!lc)
|
||||
lc = localeconv ();
|
||||
if (lc && lc->decimal_point && lc->decimal_point[0])
|
||||
{
|
||||
strncpy (p->value, lc->decimal_point, sizeof (p->value) - 1);
|
||||
p->value[sizeof (p->value) - 1] = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_atexit (free_static_svg_decimal_point);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void destroy (hb_vector_decimal_point_t *p)
|
||||
{ hb_free (p); }
|
||||
|
||||
static const hb_vector_decimal_point_t *get_null ()
|
||||
{ return &hb_vector_decimal_point_default; }
|
||||
} static_svg_decimal_point;
|
||||
|
||||
static inline void
|
||||
free_static_svg_decimal_point ()
|
||||
{
|
||||
static_svg_decimal_point.free_instance ();
|
||||
}
|
||||
|
||||
const char *
|
||||
hb_vector_decimal_point_get (void)
|
||||
{
|
||||
return static_svg_decimal_point.get_unconst ()->value;
|
||||
}
|
||||
@@ -39,3 +39,95 @@
|
||||
* The initial backend is SVG. Extents must be set before calling render
|
||||
* functions; otherwise render returns `NULL`.
|
||||
**/
|
||||
/*
|
||||
* Copyright © 2026 Behdad Esfahbod
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Author(s): Behdad Esfahbod
|
||||
*/
|
||||
|
||||
#include "hb.hh"
|
||||
|
||||
#include "hb-machinery.hh"
|
||||
#include "hb-vector-buf.hh"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
struct hb_vector_decimal_point_t
|
||||
{
|
||||
char value[8];
|
||||
};
|
||||
|
||||
static hb_vector_decimal_point_t hb_vector_decimal_point_default = {{'.', '\0'}};
|
||||
|
||||
static inline void free_static_svg_decimal_point ();
|
||||
|
||||
static struct hb_vector_decimal_point_lazy_loader_t
|
||||
: hb_lazy_loader_t<hb_vector_decimal_point_t, hb_vector_decimal_point_lazy_loader_t>
|
||||
{
|
||||
static hb_vector_decimal_point_t *create ()
|
||||
{
|
||||
auto *p = (hb_vector_decimal_point_t *) hb_calloc (1, sizeof (hb_vector_decimal_point_t));
|
||||
if (!p)
|
||||
return nullptr;
|
||||
|
||||
p->value[0] = '.';
|
||||
p->value[1] = '\0';
|
||||
|
||||
#ifndef HB_NO_SETLOCALE
|
||||
lconv *lc = nullptr;
|
||||
#ifdef HAVE_LOCALECONV_L
|
||||
hb_locale_t current_locale = hb_uselocale ((hb_locale_t) 0);
|
||||
if (current_locale)
|
||||
lc = localeconv_l (current_locale);
|
||||
#endif
|
||||
if (!lc)
|
||||
lc = localeconv ();
|
||||
if (lc && lc->decimal_point && lc->decimal_point[0])
|
||||
{
|
||||
strncpy (p->value, lc->decimal_point, sizeof (p->value) - 1);
|
||||
p->value[sizeof (p->value) - 1] = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_atexit (free_static_svg_decimal_point);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void destroy (hb_vector_decimal_point_t *p)
|
||||
{ hb_free (p); }
|
||||
|
||||
static const hb_vector_decimal_point_t *get_null ()
|
||||
{ return &hb_vector_decimal_point_default; }
|
||||
} static_svg_decimal_point;
|
||||
|
||||
static inline void
|
||||
free_static_svg_decimal_point ()
|
||||
{
|
||||
static_svg_decimal_point.free_instance ();
|
||||
}
|
||||
|
||||
const char *
|
||||
hb_vector_decimal_point_get (void)
|
||||
{
|
||||
return static_svg_decimal_point.get_unconst ()->value;
|
||||
}
|
||||
@@ -734,7 +734,6 @@ hb_vector_sources = files(
|
||||
'hb-vector-paint-svg.cc',
|
||||
'hb-vector-paint-pdf.cc',
|
||||
'hb-vector-path.hh',
|
||||
'hb-vector-buf.cc',
|
||||
'hb-vector-buf.hh',
|
||||
'hb-static.cc',
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user