/* * 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): Garret Rieger */ #ifndef HB_REPACKER_HH #define HB_REPACKER_HH #include "hb-open-type.hh" #include "hb-map.hh" #include "hb-vector.hh" #include "graph/graph.hh" #include "graph/gsubgpos-graph.hh" #include "graph/serialize.hh" graph_t; /* * For a detailed writeup on the overflow resolution algorithm see: * docs/repacker.md */ struct lookup_size_t { … }; static inline bool _presplit_subtables_if_needed (graph::gsubgpos_graph_context_t& ext_context) { … } /* * Analyze the lookups in a GSUB/GPOS table and decide if any should be promoted * to extension lookups. */ static inline bool _promote_extensions_if_needed (graph::gsubgpos_graph_context_t& ext_context) { … } static inline bool _try_isolating_subgraphs (const hb_vector_t<graph::overflow_record_t>& overflows, graph_t& sorted_graph) { … } static inline bool _resolve_shared_overflow(const hb_vector_t<graph::overflow_record_t>& overflows, int overflow_index, graph_t& sorted_graph) { … } static inline bool _process_overflows (const hb_vector_t<graph::overflow_record_t>& overflows, hb_set_t& priority_bumped_parents, graph_t& sorted_graph) { … } inline bool hb_resolve_graph_overflows (hb_tag_t table_tag, unsigned max_rounds , bool always_recalculate_extensions, graph_t& sorted_graph /* IN/OUT */) { … } /* * Attempts to modify the topological sorting of the provided object graph to * eliminate offset overflows in the links between objects of the graph. If a * non-overflowing ordering is found the updated graph is serialized it into the * provided serialization context. * * If necessary the structure of the graph may be modified in ways that do not * affect the functionality of the graph. For example shared objects may be * duplicated. * * For a detailed writeup describing how the algorithm operates see: * docs/repacker.md */ template<typename T> inline hb_blob_t* hb_resolve_overflows (const T& packed, hb_tag_t table_tag, unsigned max_rounds = 32, bool recalculate_extensions = false) { … } #endif /* HB_REPACKER_HH */