How to write Bidirectional text in inkscape? - inkscape

I want to write text which contain words from RTL and LTR languages. How I can achieve that?
Now, I can write the words just right but in reverse order.

You can achieve that by adding "Arabic" language in your keyboard preference which you can switch as per your requirement.
For Linux (Ubuntu user)
For Windows User

Related

how to process arrow, pageUp, pageDown keys in C or C++ on linux

How do I get the key codes so I can process arrow, pageUp, pageDown, etc, keys using simple C or C++?
I can get the regular keys, I do not know how to get these special keys.
Ncurses should be able to handle that. There is lots of tutorials out there
Linux based systems follow the UNIX tradition, in the sense that those keys are special and their values depend on the terminal settings.
This is so, because in the old days each UNIX system had a complete different type of keyboard. As such it is somehow complex to be able to write generic code to handle those special keys.
The best way is to make use of a terminal handling library, like curses or its successor ncurses.
Here you can get a nice introduction about keyboard usage,
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/keys.html

Effective and simple way of storing multiline strings of text?

I'm trying to find a way to do this.
My game is multilingual.
I have English.txt, French.txt, etc..
I'm wondering what would be a good way to store it in the file for example:
<sendbutton.tooltip>
Use this button to send text.
The text can be as long as you like!
</sendbutton.tooltip>
or
sendbutton.tooltip = Use this button to send text.\n\nThe text can be as long as you like!
I then will map these strings to their element name for runtime use.
Other than using a standard like XML, what is usually done to do this?
Thanks
Usually this kind of localization tasks is done with GNU gettext.
It depends when are you going to load the file.
For standard translation stuff, I recommend you take a look at gettext. It provides translation tools and easy way to include it. You can store English text a C strings enclosed with translation macro () or T() or whatever, and gettext would provide you with strings that need translating. It also tracks the translations that need to be updated when original English text changes. You store all translations for specific language in separate files.
Not sure for C++ but maybe resource files where you create a separate file for each language and have key/value pairs for the lookup with each langauge using the same key but message text is in the correct language e.g.
resources.de
LOGOUT, Abmelden
resources.en
LOGOUT, Logout
then depending on users language choice, you load the appropriate resource file to display the correct text. Think you would just store the mutlilines with /n as in your second example.

C++ screen partition

I want to partition the output screen into two parts (just like frames do it in HTML). So that one part may remain fixed and display some content which is updated based on input received from the other part.
I do not wish to venture into GUI stuff therefore OpenGL, SDL etc are ruled out (I wish to do it in command line mode). I have Borland C++ with graphics.h support, but it is just too old to carry on.
What alternatives do I have at my disposal (If not C++, a solution in C will also be Ok.)
You may want to take a look at curses-like libraries like PDCurses.
Other than that, you may use ANSI terminal escape sequences to control the cursor on a text window, this may be quicker if what you are doing is simple, otherwise use PDCurses and it will handle the escape sequences for you.
Check out Curses / NCurses.

Invisible input for passwords? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Read a password from std::cin
I want to cin>>input but when they input something i don't want it to be visible to them. Like when you use passwd in unix to change your password where it doesn't show what you typed. i hope it is clear what i am asking. Thank you in advance.
From C++ FAQ Lite
This is not a standard C++ feature — C++ doesn't even require your system to have a keyboard or a screen. That means every operating system and vendor does it somewhat differently.
Please read the documentation that came with your compiler for details on your particular installation.
cin isn't the way to do this, since the OS (usually) echoes standard input. What you need to do is handle the key events at the OS-level.
There is getpass(3) for Unix-like systems, which will do what you want.
However,
It's not portable (Unix systems only).
It's deprecated ("Present in SUSv2, but marked LEGACY. Removed in POSIX.1-2001.").
There is no way to do it with standard C or C++.
If what you want is something like what you do when you enter the password to login to a linux box, that behavior cannot be achieved in C or C++. You will have to use a platform specific library to do that. More specifically, console input in C and C++ is always echoed to the console.
Have it detect key presses. Think of it this way: When a user presses the 'A' key in a video game, the program runs code; don't think of it as receiving input. Think of it as detecting keystrokes and adding each keystroke to some data structure (e.g. an array).
I am familiar with the functionality in UNIX terminal that you are talking about and it doesn't allow you to backspace or anything. If you want that functionality, just do what I said above.
If you want to be able to backspace, although the user won't be able to see what they backspace, you can write code that removes the last element of the array when the user clicks backspace.
Also, everyone else is correct when they say that you will need to program this specific to the system you're running it on.
Lastly, this might not be secure if you are using this for a password and just throwing it into an array.

Keyboard input in games (for GLUT)

Almost every game use keyboard as input. I have been searching for 2 days on this topic and found quite much about it. Keyboards have many disadvantages, but main problems I found are different layouts and second that if you are pressing 3 keys at time, it can lead to corruption (row-column error). If you don't know what I'm talking about, keyboard is made as grid and it checks which row and column has connected. But if you press E,D (row 1,2 column 3)
and R (row 1, column 4), keyboard can show even F because it find it pressed(row 2, column 4 both pressed).
So I think we can't do anything about that second, but if anyone got idea how to solve it better then use keys that don't form L, I'd be glad :)
But my main problem are different keyboard layouts which is real pain. I'm slovak so Slovak layout of numbers look like this:
+ľščťžýáíé and with shift 1234567890, we also got QWERTZ but you can use QWERTY.
You all know how the English look like but just for sure:
1234567890 and shift !##$%^&*()
Most of time I'm using english one because I got used to it when programming. Anyway there are different people using different layouts. When you are making game that depend on which key is pressed, for example good old WASD pattern, you can't use that on french one which is AZERTY layout. It would be strange. Same as using numbers for choosing gun in action game. As you can see slovak would have to press shift to get it work.
I'm also using OpeGL. There is problem when you are mapping which keys are pressed. For example widely used solution to make map of 256 bools for each charakter, is suffering from SHIFT. You press a, SHIFT and release a you got: a down, A up. So I thought about binding some keys together, as A and a, 1 and !, but then I realized I'll just change layout and everything is wrong.
So what is solution for that? I think there is someone out there that is in game industry or made some game and had to solve this. Only solution that comes on my mind is to force english layout for UI (and choosen layout for chat).
After next searching I found what I need but I need cross-platform one:
virtual key codes
And next search revealed SDL key
Result: Don't ever start with GLUT if you go making games, use SFML or SDL
Thanks to everyone for helping me, there were more problems in this so idea of key binding/mapping, SDL and so on, each helped me alot.
If you're getting a "character" every time user presses something, then your keyboard routines aren't suitable for game input - only for text entry.
You need to use input routines that completely ignore keyboard layout switching and operate on some kind of raw keycodes (so when user presses shift+a, you'll know that shift is pressed and that "a" key is pressed, but you won't get "A" character). Also, routines should allow you to query if a key is pressed or not.
For windows that is DirectInput or XInput. For cross-platform this is libsdl and SDL_GetKeyState. And you'll need to provide keymapping options for the user. Glut probably isn't suitable for your task.
The common approach seems to be to ignore the problem. Worse-is-better in its early stage.
Unfortunately I'm using svorak keyboard layout so it really doesn't just work for me.
I've been approaching this same problem by binding into multiple keys on the keyboard. So that player jumps from both x and j -keys. It doesn't do so well in something that isn't shoot-jump -kind of game.
Nice stuff would be if you could just find row/col or some driver-near interface to your keyboard.
Some auto-keyboard configuration software would be neat though I've not yet seen anything like that. Maybe we should write one?
First up, separate keypresses from text entry. You shouldn't care what letter or number comes up when you press a key with shift as well - the operating system should handle that and generate an event you can use in the rare times you need the text. Usually, you should just look for the key press and any shift presses and act on those.
Second, load the bindings from keys to commands from a data file, rather than hardcoding it. Distribute default bindings for QWERTY and whatever default layout you have. If the data format is quite straightforward then people won't mind customising it to fit their keyboard and preferences. You can also add an in-game keybinding editor later.
This isn't really about OpenGL since by default that doesn't care about keypresses. Perhaps you are using an addon library or extension that handles keys for you - ensure that whatever you're using can give you individual key values and the state of shift/alt/ctrl independently, and that it also provides text input via an independent system.
Allow your users to define the keys to use for each action ...
or use the arrow keys .. that should be pretty universal :)
Turn the keyboard input into metadata, so you could allow users to configure at their will but also provide different keyboard shortcuts depending on the keyboard layout used in a config file .