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 | 14 days 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 | 18 days 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 | 1 month 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 | 1 month 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 | 2 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 | 2 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 | 3 months 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 | 4 months 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 | 4 months 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 | 4 months 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 | 4 months 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 | 4 months 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 | 5 months 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 | 5 months 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 | 6 months 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 | 6 months 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 | 7 months 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 | 7 months 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 | 7 months 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 | 8 months 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 | 9 months 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 | 10 months 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 | 10 months 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 | 10 months 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 | 10 months 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 | 11 months 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 | 11 months 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 | 11 months 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 | 11 months 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 | 12 months 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

Jussi Pakkanen: Got the Star Trek - The Motion Picture Director's Edition box set? You might wan to check your discs

TL/DRStar Trek The Motion Picture The Complete Adventure box set claims to contain a special, longer cut of the film. However it seems that this is not the case for some editions. The British edition does contain the longer cut, but the Scandinavian one seems not to. The back of … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: In which you find out that everything you assumed was wrong

The previous post listed an algorithm for converting TrueType glyph advances into PDF glyph widths. It worked, but was weird, kludgy, complicated and all around bad. It was also completely wrong. As in "not even remotely in the direction of the correct solution" but it happened t … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: The joy of font debugging

Remember how in the previous blog post it was said that creating text in PDF would be "just a matter of setting some parameters"?Well let's start by creating the main text in two justified columns.Ok, nice. Next we add an author name.Whoopsies. After some debugging one can find o … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: The PDF text model is quite nice, actually

As was discussed earlier, the way PDF handles fonts and glyphs is arcane and tedious. It takes a lot of boilerplate and hitting your shins against sharp stones to get working. However once you do and can turn to the higher level text functionality, things become a lot nicer. (Rig … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: First A4PDF release, version 0.1.0 "embarrasment"

The time has come to make the first technical preview release of A4PDF, nicknamed embarrasment. The name stems from this statement.If you're not embarrassed by the first version of your product, you've launched too late.It does not do much yet, but the basics are there to draw sh … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: My book is finally available for purchase

A major difference between software and book projects is that the latter have a point when they can be considered complete and finished. For my debut novel, that time has come.The text block has been created with a "mini-LaTeX" DTP program that I wrote basically from scratch. Thi … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: The code functionality tipping point

Software development is weirdly nonlinear. When you start working on a new project at first it does not really do much. Adding more and more code does not seem to help. The "end user visible" functionality is pretty poor and it does not seem to get visibly better. You can do some … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Unit testing PDF generation

How would you test PDF generation?This turns out to be unexpectedly difficult because you need to check that the files are both syntactically and semantically valid. The former could be tested with existing PDF validators and converters but the latter is more difficult.If you, sa … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: PDF output in images

Generating PDF files is mostly (but not entirely) a serialization problem where you keep repeating the following loop:Find out what functionality PDF hasRead the specification to find out how it is expressed using PDF document syntaxCome up with some sort of an API to express sam … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Plain C API design, the real world Kobayashi Maru test

Designing APIs is hard. Designing good APIs that future people will not instantly classify as "total crap" is even harder. There are typically many competing requirements such as:API stabilityABI stability (if you are into that sort of thing, some are not)Maximize the amount of f … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: More PDF, C API and Python

After a whole lot of bashing my head against the desk I finally managed to find out what Acrobat reader's "error 14" means, I managed to make both font subsetting and graphics generation work. Which means you can now do things like this:After this improving the code to handle ful … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: PDF with font subsetting and a look in the future

After several days of head scratching, debugging and despair I finally got font subsetting working in PDF. The text renders correctly in Okular, goes througg Ghostscript without errors and even passes an online PDF validator I found. But not Acrobat Reader, which chokes on it com … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: Typesetting an entire book part V: Getting it published

Writing a book is not that difficult. Sure, it is laborious, but if you merely keep typing away day after day, eventually you end up with a manuscript. Writing a book that is "good" or one that other people would want to read is a lot harder. Still, even that is easy compared to … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: PDF, text and fonts, a design by The Devil & Associates

PDF has a fairly straightforward model for rendering text. Basically you specify a font to use, define a transformation matrix if needed and specify the text string to render. The PDF renderer will then load the embedded font file, extract the curves needed for your letters and r … | Continue reading


@nibblestew.blogspot.com | 1 year ago

Jussi Pakkanen: A quantitative analysis of the Trade Federation's blockade of Naboo

The events of Star Wars Episode I The Phantom Menace are based around a blockade that the Trade Federation holds over the planet Naboo. The details are not explained in the source material but it is assumed that this means that no ship can take off or land on the planet. The bloc … | Continue reading


@nibblestew.blogspot.com | 1 year ago