提交 6a45e5df 编写于 作者: G Garret Rieger 提交者: Behdad Esfahbod

Add skeleton of hb-subset-glyf, call if from hb_subset(...)

上级 31ec3c2e
......@@ -184,11 +184,13 @@ HB_ICU_headers = hb-icu.h
# Sources for libharfbuzz-subset
HB_SUBSET_sources = \
hb-subset.cc \
hb-subset-glyf.cc \
hb-subset-plan.cc \
$(NULL)
HB_SUBSET_headers = \
hb-subset.h \
hb-subset-glyf.hh \
hb-subset-plan.hh \
hb-subset-private.hh \
$(NULL)
......
/*
* Copyright © 2018 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): Garret Rieger
*/
#include "hb-subset-glyf.hh"
/**
* hb_subset_glyf:
* Subsets the glyph table according to a provided plan.
*
* Return value: subsetted glyf table.
*
* Since: 1.7.5
**/
bool
hb_subset_glyf (hb_subset_plan_t *plan,
hb_blob_t *glyf,
hb_blob_t **glyf_prime /* OUT */)
{
*glyf_prime = hb_blob_get_empty ();
return true;
}
/*
* Copyright © 2018 Google
*
* 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): Garret Rieger
*/
#ifndef HB_SUBSET_GLYF_H
#define HB_SUBSET_GLYF_H
#include "hb-subset-plan.hh"
bool
hb_subset_glyf (hb_subset_plan_t *plan,
hb_blob_t *glyf,
hb_blob_t **glyf_prime /* OUT */);
#endif /* HB_SUBSET_GLYF_HH */
......@@ -27,9 +27,12 @@
#include "hb-object-private.hh"
#include "hb-private.hh"
#include "hb-subset-glyf.hh"
#include "hb-subset-private.hh"
#include "hb-subset-plan.hh"
#include "hb-ot-glyf-table.hh"
struct hb_subset_profile_t {
hb_object_header_t header;
ASSERT_POD ();
......@@ -160,8 +163,19 @@ hb_subset (hb_subset_profile_t *profile,
// - copy the table into the output.
// - Fix header + table directory.
*result = hb_face_reference_blob(face->face);
bool success = true;
hb_blob_t *glyf = hb_face_reference_table (face->face, HB_OT_TAG_glyf);
hb_blob_t *glyf_prime = nullptr;
if (hb_subset_glyf (plan, glyf, &glyf_prime)) {
// TODO: write new glyf to new face.
} else {
success = false;
}
hb_blob_destroy (glyf_prime);
hb_blob_destroy (glyf);
*result = hb_face_reference_blob(face->face);
hb_subset_plan_destroy (plan);
return true;
return success;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册