how to use of unicode fonts in Verifone VX675 - c++

I have a problem to write Arabic text on VeriFone vx675 pay pose model.
i trying this codes line:
int ret=set_font("Tahoma.ttf");
if (ret!=0)
{
printf("con : %d, err: %s\n",ret,strerror(errno));
}
display_at(0,0,"سلام", NO_CLEAR);
but device show an error as
Invalid Argument
could anyone say to me how i should to resolve this problem. or how i can write Unicode Arabic text in Vx675 Model.
Thanks in Advance

Disclaimer: I have not worked with the Vx675 before, nor have I tried to use an Arabic font, but I think this will work...
You can't use .ttf fonts on the VeriFone terminals. Instead, you need to use VeriFone's "Font Generation Tool" to convert a .ttf to either a .vft or .fon file.
Start "Font Generation Tool". If you installed the DTK, then it should be in your start menu under "VeriFone"
Go to the "Font" menu item and select "Convert Font".
Select "Windows Unicode Font"
Select "Arabic" as the "Custom Unicode Fonts" choice. Set whatever other styles you want.
Click through the rest of the wizard and save the font file somewhere.
Download that new font file to your terminal with the rest of your program (this is typically the step I forget to do on my first run)
When you do your "display_at" function, I'm noting that you are using the Arabic character(s) directly. I have no experience with this as to whether or not it will work, but one thing you can try if it isn't working is to use printf with numerical offsets. I don't think you'll want to do that in the long-run, but it can help you get started:
printf("%c%c%c%c%c%c%c%c", 0, 1, 2, 3, 4, 5, 6, 7);

Related

control font and character set in console using visual studio c++

Every time I run debugger debugging console shows it's "prefered" font "lucida console" instead of "console" ... and always ignores diacritics from any european language characters over 0x7f are considered graphics or so...
So I ask How to select Font used in Console, type and size.
I ask too, what header file or instruction should I use to have
std::cout << "... ácido propiónico como fungicida ... y sus sales de amoníaco ... " be written with teese special á ó í or others like ñ Ç deustche dzet ...
Sorry maybe those questions need to be asked elsewhere ... I would be pleased to learn where and how ...
thanks
SetCurrentConsoleFontEx would be my starting point.
Note the font selection is by index, and these are defined in the registry:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
Note: the names needs to be a sequence of "0" and the value is the font name.
But you would be better off just setting the console properties for that Window: they are retained per executable: open the system menu of the console window and modify its properties.

How to Display a Smiley Face in C++ Console

When I use to have Windows 7, I use to be able to use certain codes for my C++ programs to create acsii symbols. For example, if I did "cout << (char)1;" my program would display a white smiley face in the console box. Now since I updated to Windows 10, those codes do not work anymore.
I've done research and figured out the unicode from Windows 10 has changed. In the link below, I use to be able to use symbol/code 1 through 31 but now they appear not to work on Windows 10.
Link: https://www.alt-codes.net/
My question is, is there anyway to be able to get codes 1-31 back, possibly by downloading the Windows 7 unicode or is there a new symbol to paste the smiley face from the link? And if that's the case, how would I show it from doing this: "cout << (char) ??? ";
When I use cout < (char)1, it displays displays a box with a question mark inside of it.

Is it possible to print Bengali language with C in console?

Is it possible to print Bengali Language with C in console? If it can be done, how can I do it?
I tried:
wprintf (L"Character: %lc %lc \n", L'ঈ', 2440);
This does not work. It just shows an unknown symbol. What is the best formula for working with UTF-8 format data in console? If it is possible with C++, I want to know that.
To use a language & display it is very much an OS dependent task and below are few generic possible ways to do it.
On linux :
Set Locale,
In your case it should be : setlocale(LC_ALL, 'bn_IN.utf8');
Refer : (http://www.linuxquestions.org/questions/linux-newbie-8/displaying-hindi-in-linux-command-prompt-terminal-4175448642/)
Download appropriate font & install in your system.
Check your : cd /usr/share/fonts/ for the font.
edit your .bashrc file and add your font like this:
export LANG=bn_IN.UTF-8
(Side effect your whole os may start using this font if it supports).
On Windows :
Necessary criteria for fonts to be available in a command window
How to print a unicode string to console?
Refer
Note : Your Terminal must support Unicode for any of this to work.

Win32 C++ getting text from elements

While this question has probably been asked a thousand times before (pretty sure of it I have read a thousand answers). I still don't get it.
Lets say I have a function that creates a ComboBox like this:
scopeComboSelector=CreateCombobox(hwnd,
GetModuleHandle(0),
CBS_DROPDOWNLIST,
re,
IDCC_DROPDOWNLIST_SCOPE_SELECTOR,
_T("Scopes"));
Where "re" is a positioning rectangle. And IDCC_DROPDOWNLIST_SCOPE_SELECTOR (pretty long name) is the id of the combobox. Now the point is, I can actually fill this "drop down select list" but I have no clue as how I can simply get the currently selected value as a string.
I have seen about 10 ways to do it, which all give errors straight away (need to Convert to LPWSTR -> fixing results in more terror).
Maybe I'm just to used to Java where one can simply say:
textfield.getText();
How would one achieve this in Win32 C++ (microsoft visual studio)?
Edit
Code I've used:
char userName[_MAX_PATH+1];
GetDlgItemTextW(scopeComboSelector,
IDCC_DROPDOWNLIST_SCOPE_SELECTOR,
(LPWSTR)userName,
200);
Returns: userName == empty
Update
Now using: GetDlgItemText(). Debugger tells me the value of userName = ""
The documentation has a C style Windows 9x code example.
You need simply to replace C with C++ and Windows 9x silly T macros with wchar_t and friends.
It's always a good idea to read the documentation.

C code changes terminal text color; how can I restore defaults? Linux

I have a C file running on Linux. It prints some lines in red (failures) and some in green (passes). As you might expect, it uses escape codes in the printf statements as follows:
#define BLACK "\033[22;30m"
#define GREEN "\033[22;31m"
printf(GREEN "this will show up green" BLACK "\n");
If the BLACK at the end wasn't there, the terminal text will continue to be green for everything. In case you didn't catch it, that's fine for a terminal window with a non-black background, but otherwise you'll end up with black-on-black. Not good! Running the program has this problem, as does capturing the output in a text file and then viewing the file with "more" or "less".
Is there a code to restore defaults instead of specifying a color at the end of the printf statement? This needs to be in C, but I would be interested in reading about other approaches.
I updated my macros as follows (note 31 is for red):
#define RESET_COLOR "\e[m"
#define MAKE_GREEN "\e[32m"
printf(MAKE_GREEN "this will show up green" RESET_COLOR "\n");
I found the following links helpful in understanding how these codes work:
http://www.phwinfo.com/forum/comp-unix-shell/450861-bash-shell-escapes-not-working-via-putty-ssh.html explains what these escape sequences do, and to use ncurses if portability is needed.
http://www.linuxselfhelp.com/howtos/Bash-Prompt/Bash-Prompt-HOWTO-6.html
ANSI codes shows even more escape sequences; It is useful to get the big picture
Try using:
#define RESETCOLOR "\033[0m"
That should reset it to the defaults.
More about these terminal codes can be found in ANSI escape code.
"\033[0m"
See ANSI escape code.
Type reset in the terminal.
There is a binary found in Linux and OS X called reset.