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

Author Topic: sf::Font size not accurate  (Read 9982 times)

0 Members and 1 Guest are viewing this topic.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: sf::Font size not accurate
« Reply #15 on: September 25, 2014, 05:04:17 am »
OK... I went the whole nine yards and downloaded and installed Linux Mint 17 in a VM and built SFML with FreeType 2.5.2-1ubuntu2.2... And... I get the same result as all the other cases... With that font, there is no spacing on top of the characters. I don't know what else to try anymore :-\.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: sf::Font size not accurate
« Reply #16 on: September 25, 2014, 07:12:49 am »
I guess we wait for OP to come back with more info and/or "mark" this as "cannot reproduce". :D
I feel like I just did that to you by suggesting the futile Mint attempt: http://i.giflike.com/1LFAQu5.gif
I'm crying from laughter, sorry. ;D
Back to C++ gamedev with SFML in May 2023

Cadisol87

  • Full Member
  • ***
  • Posts: 129
  • C++ Programmer
    • View Profile
Re: sf::Font size not accurate
« Reply #17 on: September 25, 2014, 08:42:13 pm »
Okay, so I checked the Sha1 sums of the fonts, they seem to be the same as yours:
2c078150376bc66e2a4a20ffa6bbbe7a5c03e752  Facile Sans.ttf
723ce6489b30fed829e7763db700d50dfc4e26c1  Facile Sans.otf
 
Here is a screenshot of the Synaptic Package Manager, I searched for "libfreetype". It looks like I have the same libfreetype version.

Again, here is the code I used:
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace std;

int main()
{
    sf::RenderWindow window(sf::VideoMode(500, 500), "Example");
    sf::Font font;
    font.loadFromFile("Facile Sans.ttf");
    sf::Text text;
    text.setFont(font);
    text.setPosition(0, 0); // (0, -20) looks good
    text.setCharacterSize(84);
    text.setString("Text");
    text.setColor(sf::Color::Black);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear(sf::Color::White);
        window.draw(text);
        window.display();
    }

    return 0;
}

 
I use the bugfix/font_fix branch of SFML. (https://github.com/SFML/SFML/tree/bugfix/font_fix)

I hope this helps. If you need more information, just ask for it.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: sf::Font size not accurate
« Reply #18 on: September 25, 2014, 09:22:10 pm »
Yeah... I have no more ideas. I even tried building 2.0rc with your code and it yields the same result, so it really really can't have anything to do with SFML :-\. You can try reinstalling a fresh copy of Mint on a separate partition or in a virtual machine and reproduce the issue there. If you can't reproduce it, you can try to compare where the differences lie between your installation and a fresh copy, there is bound to be some discrepancy.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Cadisol87

  • Full Member
  • ***
  • Posts: 129
  • C++ Programmer
    • View Profile
Re: sf::Font size not accurate
« Reply #19 on: September 25, 2014, 10:48:56 pm »
I've set up a VM with Linux Mint, and I'm able to reproduce the problem. I didn't install any updates on the virtual machine, and I only installed the packages cmake-gui, libsfml-dev, codeblocks and g++.
I copied the CB project folder to my wm and compiled the code; it showed me the same results as on my original system.
Now I will build the bugfix branch and try to compile it without code::blocks...

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: sf::Font size not accurate
« Reply #20 on: September 25, 2014, 11:39:25 pm »
So... what happens if you do exact same, except instead of installing libsfml-dev, you grab the latest GitHub master, build it and install it? If it produces the correct results, then libsfml-dev is bogus.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Cadisol87

  • Full Member
  • ***
  • Posts: 129
  • C++ Programmer
    • View Profile
Re: sf::Font size not accurate
« Reply #21 on: September 26, 2014, 05:10:49 pm »
So... what happens if you do exact same, except instead of installing libsfml-dev, you grab the latest GitHub master, build it and install it? If it produces the correct results, then libsfml-dev is bogus.
It works perfectly, theres no space on top. Tested with a fresh Mint VM without updates. After I installed SFML in the usr/local directory, the example program didn't start, and showed me an error message that it couldn't find the SFML library, which is weird, since I linked it statically. Then I installed SFML in the root directory and it worked.
I had libsfml-dev installed  before I built SFML from source on my original system, but removed it before I started building the library (apt-get remove libsfml-dev and apt-get autoremove, I forgot to simply use purge).
So I guess that libsfml-dev was/is causing the error.

Cadisol87

  • Full Member
  • ***
  • Posts: 129
  • C++ Programmer
    • View Profile
Re: sf::Font size not accurate
« Reply #22 on: October 08, 2014, 08:54:01 pm »
Okay, its not the fault of libsfml-dev.
Today, I installed a fresh Arch Linux (x86_64), and It doesn't work. I built SFML from GitHub master with cmake.
The libraries
extra/freetype2 2.5.3-2
and
extra/libxft 2.3.2-1
were already installed (maybe they are dependencies of cinnamon).

I honestly have no idea what I could do to solve the problem :(

Does somebody have an idea?

Cadisol87

  • Full Member
  • ***
  • Posts: 129
  • C++ Programmer
    • View Profile
Re: sf::Font size not accurate
« Reply #23 on: October 15, 2014, 09:53:45 pm »
Today I built SFML from the latest GitHub source on my Win7 PC, and It also had the space on top of the text. I guess my problem is solved now, since my code won't provide different results depending on the operating system anymore! :)