// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/graphics/backends/cairo/fontcairo.cpp
// Function: smooth::GUI::FontCairo::GetTextSize(smooth::String const&) const
S::GUI::Size S::GUI::FontCairo::GetTextSize(const String &iText) const
{
	if (iText == NIL) return Size();

	String	 text	    = iText;
	Int	 textLength = text.Length();

	/* Set up Cairo font and calculate text size.
	 */
	Float		 dpi	 = Surface().GetSurfaceDPI();

	cairo_surface_t	*surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 0, 0);
	cairo_t		*context = cairo_create(surface);

	PangoLayout		*layout	= pango_cairo_create_layout(context);
	PangoFontDescription	*desc	= pango_font_description_from_string(String(fontName)
									    .Append(" ")
									    .Append(fontStyle & Font::Italic ? "Italic " : "")
									    .Append(fontWeight >= Font::Bold ? "Bold " : "")
									    .Append(String::FromInt(Math::Round(fontSize * dpi / 96.0))));

	if (textLength > 0) pango_layout_set_text(layout, text.ConvertTo("UTF-8"), -1);

	pango_layout_set_font_description(layout, desc);
	pango_font_description_free(desc);

	int	 x = 0;
	int	 y = 0;

	pango_layout_get_pixel_size(layout, &x, &y);

	g_object_unref(layout);

	cairo_destroy(context);
	cairo_surface_destroy(surface);

	return Size(x, y - 2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x18(%rbp), %rdi
xorl %esi, %esi
callq 0x59320
testb $0x1, %al
jne 0x12a10f
jmp 0x12a11d
leaq -0x8(%rbp), %rdi
callq 0x59230
jmp 0x12a55e
movq -0x18(%rbp), %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x5b6d0
movq -0x118(%rbp), %rdi
callq 0x5b800
movl %eax, -0x10c(%rbp)
jmp 0x12a145
movl -0x10c(%rbp), %eax
movl %eax, -0x34(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x59230
jmp 0x12a159
xorl %eax, %eax
movl %eax, %esi
leaq -0x58(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x5b7d0
jmp 0x12a16c
leaq -0x58(%rbp), %rdi
callq 0x5d470
movw %ax, -0x11a(%rbp)
jmp 0x12a17e
movw -0x11a(%rbp), %ax
cwtl
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x130(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5c380
movsd -0x130(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x5b5f0
movq %rax, -0x128(%rbp)
jmp 0x12a1bc
movq -0x128(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
callq 0x5c9e0
movq %rax, -0x138(%rbp)
jmp 0x12a1d9
movq -0x138(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x5d1a0
movq %rax, -0x140(%rbp)
jmp 0x12a1f6
movq -0x108(%rbp), %rsi
movq -0x140(%rbp), %rax
movq %rax, -0x78(%rbp)
addq $0x10, %rsi
leaq -0x98(%rbp), %rdi
callq 0x5b6d0
jmp 0x12a21a
leaq 0x91d5f(%rip), %rsi     # 0x1bbf80
leaq -0xb0(%rbp), %rdi
callq 0x5c1f0
jmp 0x12a22f
leaq -0x98(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x5a710
movq %rax, -0x148(%rbp)
jmp 0x12a24b
movq -0x108(%rbp), %rax
movw 0x3a(%rax), %ax
movq 0xdecf3(%rip), %rcx     # 0x208f50
movw (%rcx), %cx
andw %cx, %ax
testw %ax, %ax
leaq 0x7cb49(%rip), %rax     # 0x1a6db6
leaq 0x7b610(%rip), %rsi     # 0x1a5884
cmovneq %rax, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x5c1f0
jmp 0x12a286
movq -0x148(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x5a710
movq %rax, -0x150(%rbp)
jmp 0x12a2a2
movq -0x108(%rbp), %rax
movswl 0x38(%rax), %eax
movq 0xde16c(%rip), %rcx     # 0x208420
movswl (%rcx), %ecx
subl %ecx, %eax
leaq 0x7cafe(%rip), %rax     # 0x1a6dbe
leaq 0x7b5bd(%rip), %rsi     # 0x1a5884
cmovgeq %rax, %rsi
leaq -0xe0(%rbp), %rdi
callq 0x5c1f0
jmp 0x12a2d9
movq -0x150(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x5a710
movq %rax, -0x158(%rbp)
jmp 0x12a2f5
movq -0x108(%rbp), %rax
movswl 0xa(%rax), %eax
cvtsi2sd %eax, %xmm0
movsd -0x50(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd 0x5d1ab(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
callq 0x5a970
movq %rax, -0x160(%rbp)
jmp 0x12a327
movq -0x160(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x5b290
jmp 0x12a33c
movq -0x158(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x5a710
movq %rax, -0x168(%rbp)
jmp 0x12a358
movq -0x168(%rbp), %rdi
callq 0x5d090
movq %rax, -0x170(%rbp)
jmp 0x12a36d
movq -0x170(%rbp), %rdi
callq 0x594b0
movq %rax, -0x178(%rbp)
jmp 0x12a382
leaq -0xf8(%rbp), %rdi
callq 0x5df00
leaq -0xe0(%rbp), %rdi
callq 0x5df00
leaq -0xc8(%rbp), %rdi
callq 0x5df00
leaq -0xb0(%rbp), %rdi
callq 0x5df00
leaq -0x98(%rbp), %rdi
callq 0x5df00
movq -0x178(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0x12a4c6
movq -0x78(%rbp), %rax
movq %rax, -0x188(%rbp)
leaq 0x7b801(%rip), %rsi     # 0x1a5be6
leaq -0x30(%rbp), %rdi
callq 0x5c120
movq %rax, -0x180(%rbp)
jmp 0x12a3f7
movq -0x180(%rbp), %rsi
movq -0x188(%rbp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x590d0
jmp 0x12a411
jmp 0x12a4c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12a553
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5c380
jmp 0x12a553
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12a4b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12a4a9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12a49d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x12a491
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x5df00
leaq -0xe0(%rbp), %rdi
callq 0x5df00
leaq -0xc8(%rbp), %rdi
callq 0x5df00
leaq -0xb0(%rbp), %rdi
callq 0x5df00
leaq -0x98(%rbp), %rdi
callq 0x5df00
jmp 0x12a553
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x5a470
jmp 0x12a4d5
movq -0x80(%rbp), %rdi
callq 0x5d130
jmp 0x12a4e0
movl $0x0, -0xfc(%rbp)
movl $0x0, -0x100(%rbp)
movq -0x78(%rbp), %rdi
leaq -0xfc(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x5ad10
jmp 0x12a50d
movq -0x78(%rbp), %rdi
callq 0x5cf40
jmp 0x12a518
movq -0x70(%rbp), %rdi
callq 0x5d750
jmp 0x12a523
movq -0x68(%rbp), %rdi
callq 0x5bd80
jmp 0x12a52e
movl -0xfc(%rbp), %esi
movl -0x100(%rbp), %edx
addl $-0x2, %edx
leaq -0x8(%rbp), %rdi
callq 0x59260
jmp 0x12a548
leaq -0x30(%rbp), %rdi
callq 0x5df00
jmp 0x12a55e
leaq -0x30(%rbp), %rdi
callq 0x5df00
jmp 0x12a56b
movq -0x8(%rbp), %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)
nop