diff --git a/CMakeLists.txt b/CMakeLists.txt index 483a16a72..85eba3fd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/src/harfbuzz-world.cc b/src/harfbuzz-world.cc index 22f06553c..138a57275 100644 --- a/src/harfbuzz-world.cc +++ b/src/harfbuzz-world.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" diff --git a/src/hb-vector-buf.cc b/src/hb-vector-buf.cc deleted file mode 100644 index 5e0ef4200..000000000 --- a/src/hb-vector-buf.cc +++ /dev/null @@ -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 - -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 -{ - 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; -} diff --git a/src/hb-vector.cc b/src/hb-vector.cc index 2b4222535..b5f6c8d03 100644 --- a/src/hb-vector.cc +++ b/src/hb-vector.cc @@ -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 + +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 +{ + 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; +} diff --git a/src/meson.build b/src/meson.build index 214baa5cc..342672c93 100644 --- a/src/meson.build +++ b/src/meson.build @@ -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', )