[cbdt] Merge hb-ot-color-cbdt-table.cc into its header file
Not needed as far as can be said.
This commit is contained in:
parent
a7f694d4b0
commit
eaa2402a79
|
@ -63,7 +63,6 @@ HB_BASE_sources = \
|
||||||
hb-ot-cff2-table.cc \
|
hb-ot-cff2-table.cc \
|
||||||
hb-ot-cff2-table.hh \
|
hb-ot-cff2-table.hh \
|
||||||
hb-ot-cmap-table.hh \
|
hb-ot-cmap-table.hh \
|
||||||
hb-ot-color-cbdt-table.cc \
|
|
||||||
hb-ot-color-cbdt-table.hh \
|
hb-ot-color-cbdt-table.hh \
|
||||||
hb-ot-color-colr-table.hh \
|
hb-ot-color-colr-table.hh \
|
||||||
hb-ot-color-cpal-table.hh \
|
hb-ot-color-cpal-table.hh \
|
||||||
|
@ -254,7 +253,6 @@ HB_SUBSET_sources = \
|
||||||
hb-number.hh \
|
hb-number.hh \
|
||||||
hb-ot-cff1-table.cc \
|
hb-ot-cff1-table.cc \
|
||||||
hb-ot-cff2-table.cc \
|
hb-ot-cff2-table.cc \
|
||||||
hb-ot-color-cbdt-table.cc \
|
|
||||||
hb-static.cc \
|
hb-static.cc \
|
||||||
hb-subset-cff-common.cc \
|
hb-subset-cff-common.cc \
|
||||||
hb-subset-cff-common.hh \
|
hb-subset-cff-common.hh \
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "hb-number.cc"
|
#include "hb-number.cc"
|
||||||
#include "hb-ot-cff1-table.cc"
|
#include "hb-ot-cff1-table.cc"
|
||||||
#include "hb-ot-cff2-table.cc"
|
#include "hb-ot-cff2-table.cc"
|
||||||
#include "hb-ot-color-cbdt-table.cc"
|
|
||||||
#include "hb-ot-color.cc"
|
#include "hb-ot-color.cc"
|
||||||
#include "hb-ot-face.cc"
|
#include "hb-ot-face.cc"
|
||||||
#include "hb-ot-font.cc"
|
#include "hb-ot-font.cc"
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 2020 Google, Inc.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* Google Author(s): Calder Kitagawa
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "hb-open-type.hh"
|
|
||||||
|
|
||||||
#include "hb-ot-color-cbdt-table.hh"
|
|
||||||
|
|
||||||
namespace OT {
|
|
||||||
|
|
||||||
namespace CBDT_internal {
|
|
||||||
|
|
||||||
bool copy_data_to_cbdt (hb_vector_t<char> *cbdt_prime,
|
|
||||||
const void *data,
|
|
||||||
unsigned int length)
|
|
||||||
{
|
|
||||||
unsigned int new_len = cbdt_prime->length + length;
|
|
||||||
if (unlikely (!cbdt_prime->alloc(new_len))) return false;
|
|
||||||
memcpy (cbdt_prime->arrayZ + cbdt_prime->length, data, length);
|
|
||||||
cbdt_prime->length = new_len;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CBLC::subset (hb_subset_context_t *c) const
|
|
||||||
{
|
|
||||||
TRACE_SUBSET (this);
|
|
||||||
|
|
||||||
auto* cblc_prime = c->serializer->start_embed<CBLC> ();
|
|
||||||
|
|
||||||
// Use a vector as a secondary buffer as the tables need to be built in parallel.
|
|
||||||
hb_vector_t<char> cbdt_prime;
|
|
||||||
|
|
||||||
if (unlikely (!cblc_prime)) return_trace (false);
|
|
||||||
if (unlikely (!c->serializer->extend_min(cblc_prime))) return_trace (false);
|
|
||||||
cblc_prime->version = version;
|
|
||||||
|
|
||||||
hb_blob_t* cbdt_blob = hb_sanitize_context_t ().reference_table<CBDT> (c->plan->source);
|
|
||||||
unsigned int cbdt_length;
|
|
||||||
CBDT* cbdt = (CBDT *) hb_blob_get_data (cbdt_blob, &cbdt_length);
|
|
||||||
if (unlikely (cbdt_length < CBDT::min_size)) return_trace (false);
|
|
||||||
CBDT_internal::copy_data_to_cbdt (&cbdt_prime, cbdt, CBDT::min_size);
|
|
||||||
|
|
||||||
for (const BitmapSizeTable& table : + sizeTables.iter ())
|
|
||||||
subset_size_table (c, table, (const char *) cbdt, cbdt_length, cblc_prime, &cbdt_prime);
|
|
||||||
|
|
||||||
hb_blob_destroy (cbdt_blob);
|
|
||||||
|
|
||||||
return_trace (CBLC::sink_cbdt (c, &cbdt_prime));
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace OT */
|
|
|
@ -43,15 +43,6 @@
|
||||||
|
|
||||||
namespace OT {
|
namespace OT {
|
||||||
|
|
||||||
namespace CBDT_internal {
|
|
||||||
|
|
||||||
// Helper function internal to CBDT.
|
|
||||||
HB_INTERNAL bool copy_data_to_cbdt (hb_vector_t<char> *cbdt_prime,
|
|
||||||
const void *data,
|
|
||||||
unsigned int length);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
struct cblc_bitmap_size_subset_context_t
|
struct cblc_bitmap_size_subset_context_t
|
||||||
{
|
{
|
||||||
const char *cbdt;
|
const char *cbdt;
|
||||||
|
@ -69,6 +60,18 @@ struct cblc_bitmap_size_subset_context_t
|
||||||
hb_codepoint_t end_glyph; /* OUT */
|
hb_codepoint_t end_glyph; /* OUT */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
_copy_data_to_cbdt (hb_vector_t<char> *cbdt_prime,
|
||||||
|
const void *data,
|
||||||
|
unsigned length)
|
||||||
|
{
|
||||||
|
unsigned int new_len = cbdt_prime->length + length;
|
||||||
|
if (unlikely (!cbdt_prime->alloc (new_len))) return false;
|
||||||
|
memcpy (cbdt_prime->arrayZ + cbdt_prime->length, data, length);
|
||||||
|
cbdt_prime->length = new_len;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
struct SmallGlyphMetrics
|
struct SmallGlyphMetrics
|
||||||
{
|
{
|
||||||
bool sanitize (hb_sanitize_context_t *c) const
|
bool sanitize (hb_sanitize_context_t *c) const
|
||||||
|
@ -279,7 +282,7 @@ struct IndexSubtable
|
||||||
|
|
||||||
auto* header_prime = subtable_prime->get_header();
|
auto* header_prime = subtable_prime->get_header();
|
||||||
unsigned int new_local_offset = cbdt_prime->length - (unsigned int) header_prime->imageDataOffset;
|
unsigned int new_local_offset = cbdt_prime->length - (unsigned int) header_prime->imageDataOffset;
|
||||||
if (unlikely (!CBDT_internal::copy_data_to_cbdt (cbdt_prime, cbdt + offset, length))) return_trace (false);
|
if (unlikely (!_copy_data_to_cbdt (cbdt_prime, cbdt + offset, length))) return_trace (false);
|
||||||
|
|
||||||
return_trace (subtable_prime->add_offset (c, new_local_offset, size));
|
return_trace (subtable_prime->add_offset (c, new_local_offset, size));
|
||||||
}
|
}
|
||||||
|
@ -868,8 +871,8 @@ struct CBDT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
hb_blob_t* reference_png (hb_font_t *font,
|
hb_blob_t*
|
||||||
hb_codepoint_t glyph) const
|
reference_png (hb_font_t *font, hb_codepoint_t glyph) const
|
||||||
{
|
{
|
||||||
const void *base;
|
const void *base;
|
||||||
const BitmapSizeTable &strike = this->cblc->choose_strike (font);
|
const BitmapSizeTable &strike = this->cblc->choose_strike (font);
|
||||||
|
@ -944,6 +947,34 @@ struct CBDT
|
||||||
DEFINE_SIZE_ARRAY(4, dataZ);
|
DEFINE_SIZE_ARRAY(4, dataZ);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
CBLC::subset (hb_subset_context_t *c) const
|
||||||
|
{
|
||||||
|
TRACE_SUBSET (this);
|
||||||
|
|
||||||
|
auto* cblc_prime = c->serializer->start_embed<CBLC> ();
|
||||||
|
|
||||||
|
// Use a vector as a secondary buffer as the tables need to be built in parallel.
|
||||||
|
hb_vector_t<char> cbdt_prime;
|
||||||
|
|
||||||
|
if (unlikely (!cblc_prime)) return_trace (false);
|
||||||
|
if (unlikely (!c->serializer->extend_min(cblc_prime))) return_trace (false);
|
||||||
|
cblc_prime->version = version;
|
||||||
|
|
||||||
|
hb_blob_t* cbdt_blob = hb_sanitize_context_t ().reference_table<CBDT> (c->plan->source);
|
||||||
|
unsigned int cbdt_length;
|
||||||
|
CBDT* cbdt = (CBDT *) hb_blob_get_data (cbdt_blob, &cbdt_length);
|
||||||
|
if (unlikely (cbdt_length < CBDT::min_size)) return_trace (false);
|
||||||
|
_copy_data_to_cbdt (&cbdt_prime, cbdt, CBDT::min_size);
|
||||||
|
|
||||||
|
for (const BitmapSizeTable& table : + sizeTables.iter ())
|
||||||
|
subset_size_table (c, table, (const char *) cbdt, cbdt_length, cblc_prime, &cbdt_prime);
|
||||||
|
|
||||||
|
hb_blob_destroy (cbdt_blob);
|
||||||
|
|
||||||
|
return_trace (CBLC::sink_cbdt (c, &cbdt_prime));
|
||||||
|
}
|
||||||
|
|
||||||
struct CBDT_accelerator_t : CBDT::accelerator_t {};
|
struct CBDT_accelerator_t : CBDT::accelerator_t {};
|
||||||
|
|
||||||
} /* namespace OT */
|
} /* namespace OT */
|
||||||
|
|
Loading…
Reference in New Issue