Giter Site home page Giter Site logo

sfttf's Introduction

Project files are in the build directory.
Included project files:
	Linux:
		codeblocks/gcc
	Windows:
		codeblocks/vc2008
		vc2008


Usage:
Everything lives in the sfttf namespace.
You must create a FontManager to load/use any fonts.

sfttf::FontManager FontMgr;
FontMgr.Initialize();
sfttf::Font* Font = FontMgr.loadFont("Font.ttf");
Font->setSize(22);
Font->drawString("Hello, World!", 5.0f, 22.0f);

When characters are drawn, there are a few factors
that affect the output:
-Kerning	Whether kerning is used (if the font supports it)
-Fill		Fill determines whether a filled (normal) character is drawn
-Size		This is the size of the character in pixels
-Outline	Outline determines whether an outlined character is drawn
-Outline size	This is the size of the outline

-Color		The color of the filled character
-Outline color	The color of the outlined character

Here's an example:
Font->setKerning(true);			//Enable kerning, if supported
Font->setFill(true);			//Draw filled character
Font->setOutline(true);			//Draw outlined character
Font->setSize(72);			//Set the character's size
Font->setOutlineSize(2);		//Set the outline size
Font->setColor(sf::Color::White);	//Set the fill color
Font->setOutlineColor(sf::Color::Blue);	//Set the outline color
Font->drawString("Some text", 100.0f, 100.0f);

It can be quite cumbersome to set all these settings every time.
What if you want to preserve most of them, but change just a few?
Example:
Font->setSize(72);
Font->setColor(sf::Color::White);
...

Font->Push();	//This saves the current settings
Font->setSize(22);
..
Font->drawString("This is size 22", 100.0f, 100.0f);
Font->Pop();	//This restores the current settings

Font->drawString("This is size 72", 100.0f, 200.0f);

sfttf's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.