Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dreadward07

Pages: [1]
1
Graphics / Re: How to render in color emojis?
« on: December 10, 2023, 04:46:24 pm »
I tried using sf::String and the seguiemj font, as Noto also shows blank boxes

sf::Font font;
font.loadFromFile("C:/Windows/Fonts/seguiemj.ttf");

sf::Text text;
text.setFont(font);

text.setString(u8"🌙");

window.draw(text);

However this displays the following:
https://ibb.co/Lrx0YwB

2
Graphics / How to render in color emojis?
« on: December 10, 2023, 05:09:19 am »
Hello! I am trying to render an emoji on screen using Google's Noto font. However, it always either renders blank squares, or nothing at all. Here's a link to the download:
https://fonts.google.com/noto/specimen/Noto+Color+Emoji

And here's the small amount of code I've written to try and display it.

#include <SFML/Graphics.hpp>

int main()
{

        sf::RenderWindow window(sf::VideoMode(640, 480), "Emoji", sf::Style::Close);
        sf::Event event;
        sf::Clock clock;
        while (window.isOpen())
        {
                while(window.pollEvent(event))
                {
                        switch (event.type)
                        {
                        case(sf::Event::Closed):
                        {
                                window.close();
                        }
                        }
                }

                window.clear();

                sf::Font font;
                font.loadFromFile("NotoColorEmoji-Regular.ttf");
               
                sf::Text text;
                text.setFont(font);
                text.setString("Test Text");

                window.draw(text);

                window.display();
        }

        return 0;
}

What am I doing wrong? I'm pretty sure this font doesn't contain any standard characters, which makes sense, but if that's the case, how do I render anything at all? Do I use Unicode? Glyphs? If it's either, then how do I use them?
I'm VERY new to the concept of fonts and character encoding as a whole, so I understand if I've missed something completely obvious.

Thank you for your help!

Pages: [1]