/* Copyright (C) 2017-2021, Dirk Krause SPDX-License-Identifier: BSD-3-Clause */ /* WARNING: This file was generated by the dkct program (see http://dktools.sourceforge.net/ for details). Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: dk4fontc.ctr */ #ifndef DK4FONTC_H_INCLUDED /** Avoid multiple inclusions. */ #define DK4FONTC_H_INCLUDED 1 /** @file dk4fontc.h LaTeX font collector. */ #ifndef DK4CONF_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include "dk4conf.h" #else #include #endif #endif #ifndef DK4TYPES_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include #else #include #endif #endif #ifndef DK4ERROR_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include #else #include #endif #endif #ifndef DK4FONT_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include #else #include #endif #endif #ifndef DK4STO_H_INCLUDED #if DK4_BUILDING_DKTOOLS4 #include #else #include #endif #endif /** How to use specified font and size. */ enum dk4_gra_tf_t_ { DK4_GRA_TF_NONE_NONE = 0 , /**< No font choosing. */ DK4_GRA_TF_NONE_SIZE = 1 , /**< No font, with size. */ DK4_GRA_TF_SIMILAR_NONE = 2 , /**< Choose similar font, no size. */ DK4_GRA_TF_SIMILAR_SIZE = 3 , /**< Choose similar font, with size. */ DK4_GRA_TF_EXACT_NONE = 4 , /**< Choose exact font but no size. */ DK4_GRA_TF_EXACT_SIZE = 5 , /**< Exact font and size. */ /** For normal text use exact font as specified. */ DK4_GRA_TF_NORMAL = DK4_GRA_TF_EXACT_SIZE , /** For special text use similar features and size. */ DK4_GRA_TF_SPECIAL = DK4_GRA_TF_SIMILAR_SIZE , }; /** How to use specified font and size. */ typedef enum dk4_gra_tf_t_ dk4_gra_tf_t; /** One font to register. */ typedef struct { double fsz; /**< Font size in pt. */ size_t nf; /**< Number of font in font collection. */ int fno; /**< Font number or feature set. */ int fex; /**< Flag: Use exact font. */ } dk4_font_item_t; /** Font collection. */ typedef struct { dk4_sto_t *s_fo; /**< Fonts by font ID or font features. */ dk4_sto_t *s_fn; /**< Fonts by number. */ dk4_sto_it_t *i_fo; /**< Iterator for fonts by ID or features. */ dk4_sto_it_t *i_fn; /**< Iterator for fonts by number. */ size_t nfonts; /**< Number of fonts stored, next font. */ } dk4_font_collector_t; #ifdef __cplusplus extern "C" { #endif /** Open new font collector, allocate resources. After using a font collector obtained from this function the collector must be closed using the dk4fontc_close() function. @param erp Error report for diagnostics. @return Valid pointer to new font collector on success, NULL on error. Error codes: - DK4_E_MEMORY_ALLOCATION_FAILED
if there is not enough memory available. */ dk4_font_collector_t * dk4fontc_open( dk4_er_t *erp ); /** Close font collector, release resources. @param fc Font collector to close and release. */ void dk4fontc_close( dk4_font_collector_t *fc ); /** Check whether a specified font is already in the collector, add if necessary. @param pdst Address of result variable for font number. @param fc Font collector to query. @param fno Font number. @param fsz Font size in pt. @param fex Flag: Use exact font (1) or similar font (0). @param erp Error report. @return 1 on success (font in collector or successfully added), 0 on error (failed to add). Error codes: - DK4_E_INVALID_ARGUMENTS
if any argument is invalid (pdst or fc is NULL, fno is outside the valid range or fsz is negative), - DK4_E_MEMORY_ALLOCATION_FAILED
if a memory allocation failed. - DK4_E_MATH_OVERFLOW
on numeric overflow in the number of used fonts (too many fonts used). */ int dk4fontc_add_font( size_t *pdst, dk4_font_collector_t *fc, int fno, double fsz, int fex, dk4_er_t *erp ); #ifdef __cplusplus } #endif /* vim: set ai sw=4 ts=4 : */ #endif