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

Basic Cyrillic support #1647

Merged
merged 42 commits into from Oct 30, 2012

Conversation

@johnbartholomew
Copy link
Contributor

commented Oct 29, 2012

This adds basic support for rendering cyrillic characters, if the underlying font provides them. This is a rudimentary patch which just updates the current TextureFont system to include cyrillic glyphs in the glyph atlas. It is not intended to be a long term solution, but rather to provide just enough support to allow Russian translation work to continue, and to hopefully avoid turning away potential Russian developers.

For a longer term approach, I expect us to need proper font fallback to cope with characters that aren't in the current font. I also expect us to switch to a shared glyph atlas, with dynamic updates to add glyphs as they are needed (possibly adding them in blocks, i.e., if you use one character from the basic Unicode Cyrillic range it could add all glyphs in that range in one update). We may also need to use a glyph shaping/layout library like HarfBuzz (I think ICU also includes glyph layout code) to properly cope with more complex language features (we would definitely need it if we want to support non-western scripts).

Limitations of this temporary patch:

  • At larger font sizes, not all the glyphs fit into the atlas. This would be trivial to fix by bumping up the glyph atlas size. I'm not sure whether we want to pay that extra resource cost at this stage though (I don't know how much texture memory we're using right now, or what our targets should be).
  • There is no fallback mechanism; characters that aren't in the font just aren't rendered. This effectively means that to be useful, all used fonts need to provide cyrillic characters.
  • As far as I know, none of our existing fonts provide cyrillic glyphs. Combined with the previous point, this means that to use cyrillic you have to completely replace all the current fonts. Luckily, this is quite easy to do as a mod.

(*) I'm not sure -- combining marks might "just work" by having an advance value of 0 in the glyph information (so the renderer ends up automatically overlaying the combining mark with the next character).

Edit: For testing purposes, this mod replaces all current fonts with DejaVu fonts which include cyrillic glyphs:

DejaVu-everything-issue1647.zip

johnbartholomew and others added 30 commits Oct 24, 2012
I'm not sure I like this, but it minimises the changes required in the
rest of the code
Not sure this is a good idea, but never mind.
That might not be the best place long term, but for now I just don't want
IniConfig to have to remember its filename.
(this is needed so that we can cope with non-ASCII paths on Windows)
It's mostly unused; it's much less important with separate FileSource
objects for game data files and user files, since the FileSource objects
deal with knowing the base path (and other things).
This avoids a problem where ModManager tries to print to stdout before it's
been redirected. With a non-ASCII username on Windows XP this was causing
a weird crash for me. I'm still not certain what exactly the problem was.
Conflicts:
	src/Pi.cpp
	src/ui/Context.cpp
	src/ui/Skin.cpp
@johnbartholomew

This comment has been minimized.

Copy link
Owner Author

commented on 9358ad6 Oct 29, 2012

Commit message is wrong -- this is updating the vc2010 project.

@johnbartholomew

This comment has been minimized.

Copy link
Contributor Author

commented Oct 29, 2012

Related issues:

  • #1482 -- "Can't create save file and game doesn't save settings." (describes two problems; a file system problem addressed by #1632, and a display problem addressed here)
  • #1031 -- "The problem of the Russian translation"
  • #1084 -- "Text rendering"
@johnbartholomew

This comment has been minimized.

Copy link
Contributor Author

commented Oct 30, 2012

Rebased onto #1632, because it doesn't make much sense to have support for displaying Russian text but no support for saving files with Russian names.

@robn robn merged commit 0fcaeab into pioneerspacesim:master Oct 30, 2012
@Brianetta

This comment has been minimized.

@Brianetta Brianetta referenced this pull request Nov 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.