Skip to content

Add cairo-dwrite.h header file

Adrian Johnson requested to merge ajohnson/cairo:dwrite-cpp-header into master

There is currently one public dwrite function:

cairo_font_face_t *
cairo_dwrite_font_face_create_for_dwrite_fontface (void * dwrite_font_face);

The actual type of dwrite_font_face is IDWriteFontFace *, a C++ type defined in dwrite.h. We use void * to make it C compatible because we don't want any C++ ABI.

!423 (merged) is introducing some more dwrite getter/setter functions that use dwrite types substituted with void * for pointers and int for enum. The getters require casting to the correct type to avoid C++ compile errors.

It would useful to provide a C++ wrapper for the cairo dwrite functions to ensure type safety and avoid casts in user code. Cairo dwrite users are going to be using C++ because the dwrite.h header is C++ only. This MR adds an optional header only C++ wrapper around the cairo C dwrite API.

Other possible win32 header related changes that could be done are

  1. Move src/cairo-win32.h into src/win32.
  2. Move the dwrite API in cairo-win32.h into its own cairo-dwrite.h file.
Edited by Adrian Johnson

Merge request reports