mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 21:53:37 +02:00
Added support for the Font::Info struct
This commit is contained in:
1 parent
302048d29e
commit
9f4120faf4
4 files changed
+70
-1
No files matched your search
@@ -29,6 +29,7 @@
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
#include <SFML/Graphics/FontInfo.h>
|
||||
#include <SFML/Graphics/Glyph.h>
|
||||
#include <SFML/Graphics/Types.h>
|
||||
#include <SFML/System/InputStream.h>
|
||||
@@ -132,5 +133,19 @@ CSFML_GRAPHICS_API float sfFont_getLineSpacing(sfFont* font, unsigned int charac
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get the font information
|
||||
///
|
||||
/// The returned structure will remain valid only if the font
|
||||
/// is still valid. If the font is invalid an invalid structure
|
||||
/// is returned.
|
||||
///
|
||||
/// \param font Source font
|
||||
///
|
||||
/// \return A structure that holds the font information
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
CSFML_GRAPHICS_API sfFontInfo sfFont_getInfo(const sfFont* font);
|
||||
|
||||
#endif // SFML_IMAGE_H
|
||||
|
||||
#endif // SFML_FONT_H
|
||||
@@ -0,0 +1,42 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SFML - Simple and Fast Multimedia Library
|
||||
// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
// If you use this software in a product, an acknowledgment
|
||||
// in the product documentation would be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such,
|
||||
// and must not be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source distribution.
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SFML_FONTINFO_H
|
||||
#define SFML_FONTINFO_H
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Headers
|
||||
////////////////////////////////////////////////////////////
|
||||
#include <SFML/Graphics/Export.h>
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// sfFontInfo holds various information about a font
|
||||
////////////////////////////////////////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
const char* family;
|
||||
} sfFontInfo;
|
||||
|
||||
|
||||
#endif // SFML_FONTINFO_H
|
||||
@@ -20,6 +20,7 @@ set(SRC
|
||||
${SRCROOT}/Font.cpp
|
||||
${SRCROOT}/FontStruct.h
|
||||
${INCROOT}/Font.h
|
||||
${INCROOT}/FontInfo.h
|
||||
${INCROOT}/Glyph.h
|
||||
${SRCROOT}/Image.cpp
|
||||
${SRCROOT}/ImageStruct.h
|
||||
|
||||
@@ -155,3 +155,14 @@ const sfTexture* sfFont_getTexture(sfFont* font, unsigned int characterSize)
|
||||
|
||||
return &font->Textures[characterSize];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfFontInfo sfFont_getInfo(const sfFont* font)
|
||||
{
|
||||
sfFontInfo info = {NULL};
|
||||
CSFML_CHECK_RETURN(font, info);
|
||||
|
||||
info.family = font->This.getInfo().family.c_str();
|
||||
|
||||
return info;
|
||||
}
|
||||
Reference in new issue
Block a user