summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-font.c
AgeCommit message (Collapse)Author
2018-11-13Add more encoding tables.Tor Andersson
Add tables for Windows-1250, Windows-1251, and ISO-8859-1. Also add unicode_from_encoding tables. Move encodings from PDF namespace to Fitz.
2018-09-21Regularize language and script names.Tor Andersson
Drop the unused 'serif' argument to the CJK lookup functions. Use the BCP 47 names for CJK scripts and languages: zh-Hant for traditional Chinese, zh-Hans for simplified Chinese, ja for Japanese, ko for Korean. The lookup function also allows commonly used language+country codes: zh-TW and zh-HK for traditional Chinese, zh-CN for simplified Chinese.
2018-08-22Remove the old 'nested depth' tracking.Tor Andersson
This was used to prevent infinite cycles in the Type3 font CharProcs, but the previous commits forbids all cycles in order to prevent memory leaks due to cyclic reference counts.
2018-08-22Bug 699666: Forbid cycles in Type3 font CharProcs.Tor Andersson
Thanks to oss-fuzz for reporting.
2018-07-06Squash spurious warnings with CIDToGIDMap.Robin Watts
A missing CIDToGIDMap is treated as identity.
2018-07-05Purge unused functions.Tor Andersson
2018-07-05Pass rect and matrix by value in geometry functions.Tor Andersson
Several things irk me about passing values as const pointers: * They can be NULL, which is not a valid value. * They require explicit temporary variables for storage. * They don't compose easily in a legible manner, requiring weird pointer passing semantics where the variable being assigned is hidden as an argument in the innermost function call. * We can't change the value through the pointer, requiring yet more local variables to hold copies of the input value. In the device interface where we pass a matrix to a function, we often find ourselves making a local copy of the matrix so we can concatenate other transforms to it. This copying is a lot of unnecessary busywork that I hope to eventually avoid by laying the groundwork with this commit. This is a rather large API change, so I apologize for the inconvenience, but I hope the end result and gain in legibility will be worth the pain.
2018-07-04Allow for CIDToGIDMap in font being "/Identity".Robin Watts
Previously we would have tripped over this, thrown an error and aborted loading the whole page. Any non-stream, non "Identity" CIDToGIDMaps now produce a warning rather than an error so we don't stop processing the entire page.
2018-06-22Remember the md5 digest in the fz_font struct.Tor Andersson
2018-05-15Bug 699351: Handle glyphs with uncomputable width.Sebastian Rasmussen
Previously if a glyphs units per em was 0 we'd try to divide by zero, now mupdf assumes a default value and continues.
2018-04-27Use pdf_dict_get_int, etc.Tor Andersson
2018-04-25Don't use WMode as part of CJK font lookup.Tor Andersson
Return TTC subfont index from fz_lookup_noto_font.
2018-04-25Support creating both serif and sans-serif CJK fonts in mutool create.Tor Andersson
Also support Vertical WMode.
2018-04-25Update CMaps to latest version.Tor Andersson
Remove UTF8 and UTF32 CMap resources that are not needed for PDF. Add Identity-H and Identity-V resources. Process UCS2/UTF16 and GBK CMaps to usecmap a common subset.
2018-04-24Remove need for namedump by using macros and preprocessor.Tor Andersson
Add a PDF_NAME(Foo) macro that evaluates to a pdf_obj for /Foo. Use the C preprocessor to create the enum values and string table from one include file instead of using a separate code generator tool.
2018-04-11Rework how we handle DynaLab tricky fonts in freetype.Tor Andersson
Force the face_flags to include TRICKY if we detect a DynaLab font name instead of trying to force hinting ourselves.
2018-04-03Fix error cleanup in pdf_load_font.Tor Andersson
2018-03-22Use pdf_add_new_dict family of functions.Tor Andersson
2018-03-22Use pdf_dict_put_dict family of functions.Tor Andersson
2018-03-16Simplify PDF font creation code.Tor Andersson
Don't create a useless pdf_font_desc when writing font resources. Simplify reference counting by using fewer intermediate variables.
2018-03-16Add simple fonts with 8-bit greek and cyrillic encodings.Tor Andersson
Use KOI8-U for Cyrillic, and ISO 8859-7 for Greek. Use with 'mutool create' using an extra argument to the %%Font directive: %%Font TmRmC Times-Roman Cyrillic BT /TmRmC 16 Tf 10 10 Td <fa c4 d2 c1 d7 d3 d4 d7 d5 ca d4 c5 21> Tj ET The alternatives are "Latin", "Greek", and "Cyrillic".
2018-03-16Add simple CJK font creation.Tor Andersson
Create a non-embedded CJK font using UTF-16 encoding. This can be used in mutool create like so: %%CJKFont Ming GB1 BT /Ming 10 Tf 100 100 Td <4F60 597D> Tj ET
2018-03-07Distinguish between simple and CID font resources in cache.Tor Andersson
2018-02-06Bug 698990: Start new run of font width only if not at end.Sebastian Rasmussen
Previously, while at the very last glyph mupdf would allocate a new array for a run of distinct glyph widths and then not drop it while leaving the function. Now a new run of font widths is only started if not at the very last glyph.
2018-01-31Use convenience pdf dictionary/array creation functions.Tor Andersson
2017-11-23Workaround freetype synthesizing unicode cmaps.Tor Andersson
2017-11-09Bug 698353: Avoid having our API depend on DEBUG/NDEBUG.Robin Watts
Currently, our API uses static inlines for fz_lock and fz_unlock, the definitions for which depend on whether we build NDEBUG or not. This isn't ideal as it causes problems when people link a release binary with a debug lib (or vice versa). We really want to continue to use static inlines for the locking functions as used from MuPDF, as we hit them hard in the keep/drop functions. We therefore remove fz_lock/fz_unlock from the public API entirely. Accordingly, we move the fz_lock/fz_unlock static inlines into fitz-imp.h (an internal header), together with the fz_keep_.../fz_drop_... functions. We then have public fz_lock/fz_unlock functions for any external callers to use that are free of compilications. At the same time, to avoid another indirection, we change from holding the locking functions as a pointer to a struct to a struct itself.
2017-07-06pdf: Drop font descriptor in case of error.Sebastian Rasmussen
2017-06-22Use unsigned char arrays in hexdumped data.Tor Andersson
2017-06-22Add const to pdf_toname.Tor Andersson
2017-05-31Avoid double literals causing casts to float.Sebastian Rasmussen
2017-04-27Clean up store debug printing.Tor Andersson
Replace fz_print_hash with fz_hash_for_each iterator. Use string formatting callback.
2017-04-27Include required system headers.Tor Andersson
2017-03-28pdf: Use FZ_ERROR_SYNTAX code for syntax errors.Tor Andersson
2017-03-24Ensure fz_store_types are all static const.Robin Watts
2017-03-22Rename fz_putc/puts/printf to fz_write_*.Tor Andersson
Rename fz_write to fz_write_data. Rename fz_write_buffer_* and fz_buffer_printf to fz_append_*. Be consistent in naming: fz_write_* calls write to fz_output. fz_append_* calls append to fz_buffer. Update documentation.
2017-03-03Fix 697554: Use the first 'cmap' table that matches.Tor Andersson
The bug report has an embedded truetype font with 7 different mac roman cmaps. Only the first one has the expected behavior, but we were picking up the last one.
2017-03-03pdf: Additional entries in Mac OS Roman encoding not in MacRomanEncoding.Tor Andersson
When encoding truetype fonts via the mac roman cmap table, we should be using the additional entries introduced in PDF 1.5, which are different from the standard MacRomanEncoding table in the appendix.
2016-11-14Make fz_buffer structure private to fitz.Robin Watts
Move the definition of the structure contents into new fitz-imp.h file. Make all code outside of fitz access the buffer through the defined API. Add a convenience API for people that want to get buffers as null terminated C strings.
2016-10-19Rename internal headers to follow pattern *-imp.h.Sebastian Rasmussen
2016-10-18Avoid checking argument to fz_drop_*()/fz_free().Sebastian Rasmussen
As fz_drop_*()/fz_free() all must handle NULL.
2016-10-05Move fz_font definition to be private.Robin Watts
Move the definition of fz_font to be in a private header file rather than in the public API. Add accessors for specific parts of the structure and use them as appropriate. The font flags, and the harfbuzz records remain public. This means that only 3 files now need access to the font implementation (font.c, pdf-font.c and pdf-type3.c). This may be able to be improved further in future.
2016-09-01Always use glyph aliases when creating encoding tables.Tor Andersson
We were only looking through the glyph name alias list for Type1 fonts. Change the encodings for truetype to use the full glyph list alias list as a fallback when the regular encoding by code point fails.
2016-09-01pdf: Load/open streams by indirect reference object when possible.Tor Andersson
2016-09-01Simplify PDF resource caching table handling.Tor Andersson
2016-07-06pdf: Drop generation number from public interfaces.Tor Andersson
The generation number is only needed for decryption, and is assumed to be zero or irrelevant for all other uses. Store the original object number and generation in the xref slot, so that we can decrypt them even when the objects have been renumbered, without needing to pass the original object number around through the stream loading APIs.
2016-06-22Use vertical presentation forms.Tor Andersson
Remap glyphs using presentation form code points rather than having a separate vertical variant of the CJK font using truetype collections. Recreate DroidSansFallback fonts from original source, extend the glyph coverage from DroidSans, subset the glyphs to match CJK CID collections, and optimize the outlines using fontcrunch.
2016-06-17Use 'size_t' instead of int as appropriate.Robin Watts
This silences the many warnings we get when building for x64 in windows. This does not address any of the warnings we get in thirdparty libraries - in particular harfbuzz. These look (at a quick glance) harmless though.
2016-06-14Fix typos in various parts of the code.Sebastian Rasmussen
2016-05-13Fix double free and memory leak.Tor Andersson