Jussi Pakkanen: The trials and tribulations of supporting CJK text in PDF

In the past I may have spoken critically on Truetype fonts and their usage in PDF files. Recently I have come to the conclusion that it may have been too harsh and that Truetype fonts are actually somewhat nice. Why? Because I have had to add support for CFF fonts to CapyPDF. Thi … | Continue reading


@nibblestew.blogspot.com | 3 days ago

Jussi Pakkanen: Measuring code size and performance

Are exceptions faster and/or bloatier than using error codes? Well... The traditional wisdom is that exceptions are faster when not taken, slower when taken and lead to more bloated code. On the other hand there are cases where using exceptions makes code a lot smaller. In embedd … | Continue reading


@nibblestew.blogspot.com | 24 days ago

Jussi Pakkanen: CapyPDF 0.14 is out

I have just released version 0.14 of CapyPDF. This release has a ton of new functionality. So much, in fact, that I don't even remember them all. The reason for this is that it is actually starting to see real world usage, specifically as the new color managed PDF exporter for In … | Continue reading


@nibblestew.blogspot.com | 1 month ago

Jussi Pakkanen: Meson build definitions merged into Git's git repo

The developers of Git have been considering switchibg build systems for a while. No definitive decision have been made as of yet, but they gave merged Meson build definitions in the main branch. Thus it now possible, and even semi-supported, to develop and build Git with Meson in … | Continue reading


@nibblestew.blogspot.com | 1 month ago

Jussi Pakkanen: CMYK me baby one more time!

Did you know that Jpeg supports images in the CMYK colorspace? And that people are actually using them in the wild? This being the case I needed to add support to them into CapyPDF. The development steps are quite simple, first you create a CMYK Jpeg file, then you create a test … | Continue reading


@nibblestew.blogspot.com | 1 month ago

Jussi Pakkanen: Compiler daemon thought experiment

According to information I have picked up somewhere (but can't properly confirm via web searches ATM) there was a compiler in the 90s (the IBM VisualAge compiler maybe?) which had a special caching daemon mode. The basic idea was that you would send your code to that process and … | Continue reading


@nibblestew.blogspot.com | 2 months ago

Jussi Pakkanen: PDF/AAAARGH

Note: the PDF/A specification is not freely available so everything here is based on reverse engineering. It might be complete bunk. There are many different "subspecies" of PDF. The most common are PDF/X and PDF/A. CapyPDF can already do PDF/X, so I figured it's time to look int … | Continue reading


@nibblestew.blogspot.com | 3 months ago

Jussi Pakkanen: Happenings at work

A few months ago this happened. Which, for those of you not up to date on your 1960s British television, is to say that I've resigned. I'm currently enjoying the unemployed life style. No, that is not me being cheeky or ironic. I'm actually enjoying being able to focus on my own … | Continue reading


@nibblestew.blogspot.com | 3 months ago

Jussi Pakkanen: CapyPDF 0.12.0 released

I have just made the 0.12 release of CapyPDF. It does not really have new features, but the API has been overhauled. It is almost guaranteed that no code developed against 0.11 will work without code changes. Such is the joy of not having any users. Experimental C++ wrapper CapyP … | Continue reading


@nibblestew.blogspot.com | 4 months ago

Jussi Pakkanen: On M and S Type Processes in Software Development

I wrote a post about so called "M type" and "S type" processes in software development. Unfortunately it discusses the concept of human sexuality. Now, just to be sure, it does not have any of the "good stuff" as the kids might say. Nonetheless this blog is syndicated in places w … | Continue reading


@nibblestew.blogspot.com | 4 months ago

Jussi Pakkanen: Meson's New Option Setup ‒ The Largest Refactoring

The problem Meson has had togglable options from almost the very beginning. These split into two camps. The first one is "common options" like optimizations, warning level, language standard version and so on. The second one is "per project" options that are specific to each proj … | Continue reading


@nibblestew.blogspot.com | 5 months ago

Jussi Pakkanen: Refactoring Python dicts to proper classes

When doing a major refactoring in Meson, I came up with a interesting refactoring technique, which I have not seen before. Some search engineing did not find suitable hits. Obviously it is entirely possible that this is a known refactoring but I don't know its name. In any case, … | Continue reading


@nibblestew.blogspot.com | 6 months ago

Jussi Pakkanen: Why refactoring is harder than you think, a pictorial representation

Suppose you are working on a legacy code base. It looks like this: Within it you find a piece of functionality that does a single thing, but is implemented in a hideously complicated way. Like so. You look at that and think: "That's awful. I know how to do it better. Faster. Easi … | Continue reading


@nibblestew.blogspot.com | 6 months ago

Jussi Pakkanen: Advanced text features and PDF

The basic text model of PDF is quite nice. On the other hand its basic design was a very late 80s "ASCII is everything everyone really needs, but we'll be super generous and provide up to 255 glyphs using a custom encoding that is not in use everywhere else". As you can probably … | Continue reading


@nibblestew.blogspot.com | 7 months ago

Jussi Pakkanen: Generative non-AI

In last week's episode of the Game Scoop podcast an idea was floated that modern computer game names are uninspiring and that better ones could be made by picking random words from existing NES titles. This felt like a fun programming challenge so I went and implemented it. Code … | Continue reading


@nibblestew.blogspot.com | 8 months ago

Jussi Pakkanen: C is dead, long live C (APIs)

In the 80s and 90s software development landscape was quite different from today (or so I have been told). Everything that needed performance was written in C and things that did not were written in Perl. Because computers of the time were really slow, almost everything was in C. … | Continue reading


@nibblestew.blogspot.com | 9 months ago

Jussi Pakkanen: CapyPDF 0.10.0 is ou

Perhaps the most interesting feature is that this new version reduces the number of external dependencies by almost 15%. More specifically the number of deps went from 7 to 6. This is due to Apple Clang finally shipping with std::format support so fmt::format could be removed. Th … | Continue reading


@nibblestew.blogspot.com | 9 months ago

Jussi Pakkanen: Aesthetics matter

When I started working on Meson I had several goals: portability, performance, usability and so on. I particularly liked the last one of these, but to my surprise this interest was not shared by people at large, especially those who used Autotools. Eventually the discussion alway … | Continue reading


@nibblestew.blogspot.com | 10 months ago

Jussi Pakkanen: Color management and API design

API design is hard. This is not a smashingly new revelation, but let's look at a sample issue I have been working on for CapyPDF. The main problem we are trying to solve is creating "print quality" PDFs. That is, ones that can be used to print things like books, magazines, poster … | Continue reading


@nibblestew.blogspot.com | 10 months ago

Jussi Pakkanen: CapyPDF 0.9.0 released

I have just released CapyPDF 0.9.0. It can be obtained either via Github or PyPI.There is no major big feature for this release. The most notable is probably the ability to create structured (or "tagged") PDF files. The code supports using both the builtin tags as well as definin … | Continue reading


@nibblestew.blogspot.com | 11 months ago

Jussi Pakkanen: Tagged PDFs with CapyPDF now sort of possible

There are many open source PDF generators available. Unfortunately they all have some limitations when it comes to generating tagged PDFsCairo does not support tagged PDFs at allLaTeX can create tagged PDFs, but obviously only out of LaTeX documentsScribus does not support tagged … | Continue reading


@nibblestew.blogspot.com | 11 months ago

Jussi Pakkanen: CapyPDF 0.8.0 released

Version 0.8.0 of the CapyPDF library has been released. The main new feature is support for form XObjects and printer's mark annotations.Printer's marks are things like color bars, crop marks and registration marks (also known as "bullseye marks") that high end printers need for … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: C++ module tooling emulator playground

Developing tooling for C++ modules is challenging to say the least. Module implementation maturity in compilers varies, they all work slightly (well massively) differently, there are bugs and you also need a code base that uses modules. Because of these and other reasons there ar … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Tagged PDF funsies

HTML was originally designed as a file format that merely contains the logical structure of a document. End users could format it in a way that was most suitable for them. For example people with reading disabilities could make the text bigger or even use a screen reader. As time … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Even more breakage in the C++ module world

In an earlier blog post we looked into some of the problems that the current C++ module implementation (specifically using Clang and CMake) has.  Yesterday it got a reply detailing a further, fairly serious problem.In order to understand the issue, let's first look at the steps u … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: AI silliness: getting to a no

One of the most annoying thing about LLM chatbots is that they all talk like american used car salespersons or people who work in sales departments of software companies. That is, the answer to every question is always yes. Somehow everything must be positive. This got me thinkin … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: On the scalability of C++ module implementations or lack thereof

This is a follow up to an earlier blog post called The road to hell is paved with good intentions and C++ modules. As it was a bit on the gloomy side so maybe I should preface this post by reiterating that adding module support to C++ is a huge task. All people who have worked on … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: CapyPDF 0.7.0 released

Version 0.7.0 of CapyPDF is out. There is nothing major as such, just a bunch of minor features. As CapyPDF already supports a fair bit of stuff, the easiest way of finding out what can be done is to look at the unit test file.Gradients, Gouraud meshes and Coons patches can now b … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: CapyPDF, performance and shared libraries

People who are extremely performance conscious might not like the fact that CapyPDF ships as a shared library with a C API that hides all internal implementation details. This has several potential sources of slowdown:Function calls can not be inlined to callersShared library fun … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: CapyPDF 0.6.0 is out

Fans of PDF generators and large rodents rejoice, version 0.6.0 of CapyPDF is out. Here is the new official logo.Probably the biggest new feature is that since Xcode has added support for C++23 features, the code now builds on macOS as well. Python wheels for Windows and macOS ca … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: The road to hell is paved with good intentions and C++ modules

The major C++ compilers are starting to ship modules implementations so I figured I'd add more support for those in Meson. That resulted in this blog post. It will not be pleasant or fun. Should you choose to read it, you might want to keep your emergency kitten image image reser … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Could we make C arrays memory safe?`Probably not, but let's try anyway

PreambleThis is a project that I have wanted to implement for a long time. However it has become quite clear that I don't have the time to do it. Thus you get this blog post instead. If someone wants to try to do this on their own, feel free. If you succeed, it would improve comp … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Circles do not exist

Many logos, drawings and other graphical designs have the following shape in it. What is this shape?If you thought: "Ah-ha! I'm smart and read the title of this blog post so I know that this is most definitely not a circle."Well it is. Specifically it is a raster image of a circl … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: A logo for CapyPDF

The two most important things about any software project are its logo and mascot. Here is a proposal for both for CapyPDF.As you can probably tell I'm not a professional artist, but you gotta start somewhere. The original idea was to have a capybara head which is wearing the PDF … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: The least convenient way of defining an alpha value

PDF's drawing model inherits from PostScript, which was originally designed in the early 80s. It works and is really nice but the one glaring hole it has is missing transparency support. The original PDF spec from 1993 has no transparency support either, it was added in version 1 … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: PDF transparency groups and composition

The PDF specification has the following image as an example of how to do transparent graphics composition.This seem simple but actually requires quite a lot of functionality:Specifying CMYK gradientsSetting the blend mode for paint operationsSpecifying transparency group xobjects … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: CapyPDF 0.4 release and presenter tool

I have just released version 0.4 of CapyPDF. You can get it either via Github or PyPI. The target of this release was to be able to create a pure Python script that can be used to generate PDF slides to be used in presentations. It does not read any input, just always produces th … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: PDF and embedded videos

PDF supports playing back video content since version 1.5. I could do the whole shtick and shpiel routine of "surely this is working technology as the specification is over 20 years old by now". But you already know that it is not the case. Probably you came here just to see how … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: PDF subpage navigation

A common presentation requirement is that you want to have a list of bullet points that appear one by one as you click forward. Almost all PDF presentations that do this fake it by having multiple pages, one for each state. So if you have a presentation with one page and five bul … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Functionality currently implemented in CapyPDF

CapyPDF has a fair bit of functionality and it might be difficult to tell from the outside what works and what does not. Here is a rough outline of implemented functionality.In the public C API (and Python)Basic draw commands in RGB, gray and CMYKICC profile supportLoading PNG, J … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: A4PDF has been renamed to CapyPDF

As alluded to in the previous post, A4PDF has changed its name. The new project name is CapyPDF. The name refers to capybaras.Original picture from here. I was in the process of drawing a proper mascot logo, but work on that stalled. Hopefully it'll get done at some point.There i … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: A4PDF release 0.2.0

I have just tagged relase 0.2.0 of A4PDF, the fully color managed PDF generation library.There are not that many new exposed features added in the public API since 0.1.0. The main goal of this release has been to make the Python integration work and thus the release is also avail … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Advanced dependency management and building Python wheels with Meson

One of the most complex pieces of developing C and C++ programs (and most other languages) is dependency management. When developing A4PDF I have used Ubuntu's default distro dependencies. This is very convenient because you typically don't need to fiddle with getting them built … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Annotated PDF, HTML, exporters

If one were to compare PDF to HTML, one interesting thing that comes up fairly quickly is that their evolution has been the exact opposite of each other.HTML was originally about structure, with its h1 and p and ul tags and the like. Given this structure the web browser was then … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: The real reason why open source software is better

The prevailing consensus at the current time seems to be that open source software is of higher quality than corresponding proprietary ones. Several reasons have been put forth on why this is. One main reason given is that with open source any programmer in the world can inspect … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: The unbearable tightness of printing

Let's say you want to print a full colour comic book in the best possible quality. For simplicity we'll use this image as an example.As you can probably guess, just putting this image in a PDF does not work, even if it had sufficient resolution. Instead what you need to do is to … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: PDF forms, the standard that seemingly isn't

Having gotten the basic graphical output or A4PDF working I wanted to see if I could make PDF form generation work.This was of course a terrible idea but sadly I lacked foresight.After a lot of plumbing code it was time to start defining form widgets. I chose to start simple and … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Some details about creating print-quality PDFs

At its core, PDF is an image file format. In theory it is not at all different from the file formats of Gimp, Krita, Photoshop and the like. It consists of a bunch of raster and vector objects on top of each other. In practice there are several differences, the biggest of which i … | Continue reading


@nibblestew.blogspot.com | 1 year ago