Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode window title (Only implemented in X11 so far) #174

Closed
wants to merge 4 commits into from
Closed

Unicode window title (Only implemented in X11 so far) #174

wants to merge 4 commits into from

Conversation

Jookia
Copy link

@Jookia Jookia commented Feb 16, 2012

Currently all it is is a new SetTitle method that uses sf::String for Unicode text. I've only implemented it on X11 so far, but it works.

ZALGO

@LaurentGomila
Copy link
Member

Thanks again for your help.

But I'm not really interested in partial implementations. For this task, the main point is to have a good overall design: there are probably other classes/functions that deal with strings and would benefit from Unicode strings. I need to find a global way of handling them in SFML. Then, is sf::String the best solution?

Then, before implementing anything, I need to make sure that every OS can support this feature.

Implementation is the very last step, and to be honest, not the most difficult one. It's just a matter of finding the right function in the OS API.

@Jookia
Copy link
Author

Jookia commented Feb 16, 2012

You have to start somewhere? According to what I can find, Windows supports UTF-16 window titles, I'm not sure about Mac OS X.

You can't just not have Unicode support. Partial is better than none in my humble opinion.

@LaurentGomila
Copy link
Member

You can't just not have Unicode support

I will add Unicode support, as this issue (that you created) implies:
#87

Partial is better than none in my humble opinion

I partially agree ;)
A partial implementation is ok, as long as it's completed fairly quickly -- and that we're sure that implementation on other OSes is technically possible.
But quick and dirty implementation is not acceptable, I won't do anything until I've found the right design. And I won't find it until I think about it. And I won't think about it before SFML 2.0 is released.

@Jookia
Copy link
Author

Jookia commented Feb 16, 2012

Ah. I understand. I wouldn't say this is quick and dirty though. sf::String supports Unicode, and having a method that takes sf::String seems to be the right way to do things. At least from what I can see.

@ghost
Copy link

ghost commented Feb 16, 2012

Just a quick thought, if there for example isn't supported on OS X. Cant sf::String then have a type of fallback mode to not use it there? Just wondering because there probably will be some stuff that will only work on one or two os, will it then be dropped everywhere?

@Jookia
Copy link
Author

Jookia commented Feb 16, 2012

It'd probably be wise to convert sf::String via ToAnsiString and pass it to the normal setTitle in that case.

@LaurentGomila
Copy link
Member

I wouldn't say this is quick and dirty though

You haven't modified the constructor, and you've kept the std::string version which is useless if there's a sf::String one. So to me this is quick and dirty: you added what you needed, without thinking about the feature more deeply, and try to integrate it smartly into the existing API.

@Jookia
Copy link
Author

Jookia commented Feb 16, 2012

I originally did modified SetTitle to interpret std::string as UTF-8, keeping ASCII support and adding Unicode support. But I was under the impression you weren't too fond of that approach seeing as SDL did it that way.

The reason why I didn't keep it that way is that it'd be odd to use UTF-8 std::string for titles, but sf::String for everything else Unicode.

@LaurentGomila
Copy link
Member

What I mean is that if you have a sf::String version, the std::string version becomes useless because sf::String can be implicitely constructed from std::string. sf::String already handles all string types automatically.

@Jookia
Copy link
Author

Jookia commented Feb 16, 2012

Ah. I did not know that. Shall I go fix it?

@LaurentGomila
Copy link
Member

Fix it in your version if you want, but like I said I won't merge this pull request.

However your X implementation will probably help me in the future, so thanks anyway ;)

Kapho referenced this pull request Mar 4, 2013
- Changed SFML API to receive an sf::String as the window title instead
  of a std::string (in Window::Window and Window::setTitle).
- Changed RenderWindow and WindowImpl APIs accordingly.
- Changed WindowImplWin32 to use a Unicode window title only if the
  target OS supports it.
- Changed WindowImplCocoa to always use Unicode window titles and added
  a utility function to Window/OSX/cpp_objc_conversion.mm.
- Changed WindowImplX11 to set the Unicode window title as part of the
  _NET_WM_NAME specification, which sadly is not part of the official X
  standard, but the closest anything can get. Still set regular ASCII
  title as fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants