diff src/core/font.h @ 79:8f95462ac5f8

core: create a debugging API, closes #2469 @2h
author David Demelier <markand@malikania.fr>
date Sun, 02 Feb 2020 15:48:36 +0100
parents 6203e1ac9b18
children ed72843a7194
line wrap: on
line diff
--- a/src/core/font.h	Fri Jan 31 13:57:57 2020 +0100
+++ b/src/core/font.h	Sun Feb 02 15:48:36 2020 +0100
@@ -37,6 +37,14 @@
 struct texture;
 
 /**
+ * \brief Font style for rendering.
+ */
+enum font_style {
+	FONT_STYLE_NONE,                /*!< No antialiasing. */
+	FONT_STYLE_ANTIALIASED          /*!< Pretty antialiasing looking. */
+};
+
+/**
  * Open font from path file.
  *
  * \pre path != NULL
@@ -61,6 +69,12 @@
 font_openb(const void *buffer, size_t buflen, unsigned int size);
 
 /**
+ * Similar to \ref font_render_ex with predefined convenient values.
+ */
+struct texture *
+font_render(struct font *font, const char *text, unsigned long color);
+
+/**
  * Render a text.
  *
  * \pre font != NULL
@@ -68,9 +82,23 @@
  * \param font the font handle
  * \param text the text in UTF-8
  * \param color the color
+ * \param style the font style
  */
 struct texture *
-font_render(struct font *font, const char *text, unsigned long color);
+font_render_ex(struct font *font,
+               const char *text,
+               unsigned long color,
+               enum font_style style);
+
+/**
+ * Get the maximum height for all glyphs.
+ *
+ * \pre font != NULL
+ * \param font the font handle
+ * \return the height in pixels
+ */
+unsigned int
+font_height(const struct font *font);
 
 /**
  * Close the font.