mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-26 13:06:13 +01:00
Merge pull request #56 from zsbzsb/feature/underline
Added underline functions to sfFont
This commit is contained in:
commit
6fa1212560
2 files changed
+40
-17
No files matched your search
@@ -121,6 +121,33 @@ CSFML_GRAPHICS_API float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint3
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the position of the underline
|
||||
///
|
||||
/// Underline position is the vertical offset to apply between the
|
||||
/// baseline and the underline.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param characterSize Reference character size
|
||||
///
|
||||
/// \return Underline position, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getUnderlinePosition(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the thickness of the underline
|
||||
///
|
||||
/// Underline thickness is the vertical size of the underline.
|
||||
///
|
||||
/// \param font Source font
|
||||
/// \param characterSize Reference character size
|
||||
///
|
||||
/// \return Underline thickness, in pixels
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API float sfFont_getUnderlineThickness(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the texture containing the glyphs of a given size in a font
|
||||
///
|
||||
|
||||
+13
-17
@@ -31,8 +31,6 @@
|
||||
#include <SFML/CallbackStream.h>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new font from a file
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFont* sfFont_createFromFile(const char* filename)
|
||||
{
|
||||
@@ -47,8 +45,6 @@ sfFont* sfFont_createFromFile(const char* filename)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new font from a file in memory
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes)
|
||||
{
|
||||
@@ -63,8 +59,6 @@ sfFont* sfFont_createFromMemory(const void* data, size_t sizeInBytes)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Create a new font from a custom stream
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFont* sfFont_createFromStream(sfInputStream* stream)
|
||||
{
|
||||
@@ -82,8 +76,6 @@ sfFont* sfFont_createFromStream(sfInputStream* stream)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Copy an existing font
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFont* sfFont_copy(const sfFont* font)
|
||||
{
|
||||
@@ -93,8 +85,6 @@ sfFont* sfFont_copy(const sfFont* font)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Destroy an existing font
|
||||
////////////////////////////////////////////////////////////
|
||||
void sfFont_destroy(sfFont* font)
|
||||
{
|
||||
@@ -102,8 +92,6 @@ void sfFont_destroy(sfFont* font)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get a glyph in a font
|
||||
////////////////////////////////////////////////////////////
|
||||
sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int characterSize, sfBool bold)
|
||||
{
|
||||
@@ -126,8 +114,6 @@ sfGlyph sfFont_getGlyph(sfFont* font, sfUint32 codePoint, unsigned int character
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the kerning value corresponding to a given pair of characters in a font
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned int characterSize)
|
||||
{
|
||||
@@ -135,8 +121,6 @@ float sfFont_getKerning(sfFont* font, sfUint32 first, sfUint32 second, unsigned
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the line spacing value
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize)
|
||||
{
|
||||
@@ -145,7 +129,19 @@ float sfFont_getLineSpacing(sfFont* font, unsigned int characterSize)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Get the texture containing the glyphs of a given size in a font
|
||||
float sfFont_getUnderlinePosition(sfFont* font, unsigned int characterSize)
|
||||
{
|
||||
CSFML_CALL_RETURN(font, getUnderlinePosition(characterSize), 0)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
float sfFont_getUnderlineThickness(sfFont* font, unsigned int characterSize)
|
||||
{
|
||||
CSFML_CALL_RETURN(font, getUnderlineThickness(characterSize), 0)
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user