Skip to content

Commit

Permalink
Fixed Cairo example test
Browse files Browse the repository at this point in the history
  • Loading branch information
OleksiiBulba committed Dec 20, 2024
1 parent 5ddf092 commit 310a74a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/cairo-pdf-rendering/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ int main(void) {
// We require some kind of global reference to a valid
// cairo instance to properly measure text.
// Note that due to this, this interface is not thread-safe!
Clay_Cairo_Initialize(cr);
Clay_Renderer_Initialize((struct Clay_Renderer_Data *)cr);

uint64_t totalMemorySize = Clay_MinMemorySize();
Clay_Arena clayMemory = (Clay_Arena) { .label = CLAY_STRING("Clay Memory Arena"), .memory = malloc(totalMemorySize), .capacity = totalMemorySize };
Clay_SetMeasureTextFunction(Clay_Cairo_MeasureText);
Clay_SetMeasureTextFunction(Clay_Renderer_MeasureText);

// We initialize Clay with the same size
Clay_Initialize(clayMemory, (Clay_Dimensions) { width, height });
Expand All @@ -145,7 +145,7 @@ int main(void) {

Clay_RenderCommandArray commands = Clay_EndLayout();
// Pass our layout to the cairo backend
Clay_Cairo_Render(commands);
Clay_Renderer_Render(commands);

// To keep this example short, we will not emit a second page in the PDF.
// But to do so, you have to
Expand Down

0 comments on commit 310a74a

Please sign in to comment.