# Detecting keyboard layout used on Windows

[code lang=”c”]//Pseudo C/C# code:

int localeId = GetKeyboardLayout(0);

// The low word contains a Language Identifier for the input language
// and the high word contains a device handle to the physical layout
// of the keyboard.
localeId &= 0xffff; // mask off high word to get the locale
// identifier

switch (localeId) {
0x040c:
0x080c:
0x1009:
useAzertyMapping();
default:
useQwertyMapping();
}
[/code]

# Predefined macros

So with the GNU compiler you can use the preprocessor to get a list of the predefined macros:

[code lang=”bash”]
$cpp -dM /dev/null [/code] or if you prefer to invoke the preprocessor via gcc itself: [code lang=”bash”]$ gcc -dM -E – < /dev/null
[/code]

This should give you a list similar like:

[code lang=”c”]
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __DEC64_DEN__ 0.000000000000001E-383DD
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 2147483647
[/code]

For Microsoft’s Visual C++ compiler I have only found pages like:

For Intel’s C++ compiler I found the following page with predefined macros.

And I find this interesting page with a lot of different compilers and their predefined macros to identify them and their versions, if any.

Edit: I also found how to do this with Clang:

[code lang=”bash”]
\$ clang -dD -E – < /dev/null
[/code]

# Upgrading dd-wrt for Windows 7, problems and a possible fix?

As noted in my earlier post I had issues with my network interface card (NIC) dropping my connection whimsically.

So finding some posts about possible firmware issues with Linksys routers and disconnects I proceeded to update my router’s firmware from dd-wrt v23 to v24 pre-sp2. This actually caused me some problems. I followed the information presented in the stickies on the dd-wrt forum, which means that prior to updating the firmware I did the 30/30/30 reset to get the factory defaults going again, then proceeded with uploading the new firmware (v24 pre-sp2 build 13064) and once that was done do the 30/30/30 reset again.

And that’s where 2-2,5 hours of frustrating would kick in. After the router had rebooted I couldn’t ping the default 192.168.1.1 address. I was getting a destination unreachable message. So alarm bells started to ring in my head, thinking I had bricked my router in some way. But the strange thing was that it looked like it rebooted correctly, no strange flashing LEDs, or not being responsive to cables being plugged in and taken out. Of course, with the router down I had no Internet connectivity to do some troubleshooting browsing. But thankfully I could use my Android mobile phone for that. I retried various reset routines but to no avail. Of course I started to despair a bit more, thinking I would have to buy a new router. I then noticed that the WLAN LED was lit up. Since my Android phone supports WiFi I figured I should see if it shows up. ‘Lo and behold, it had a network with the SSID ‘dd-wrt’ and sure enough, I could connect to it. Next was trying to router’s web interface and that worked too! Of course that enthusiasm was quickly dampened when I discovered that you cannot do a firmware upgrade over the wireless link. I also couldn’t find any way online on how to override this precautionary lockout, so it was back to square one.

And then I stumbled over a post which mentioned that Linksys routers with the original firmware sometimes have their wired LAN ports revert to 10 Mbit/half-duplex settings. After picking up my jaw from the floor I wondered if it could be so easy. Sure enough, after changing the settings for my NIC in the configuration window, I could ping 192.168.1.1 and load up the administration interface in my browser.

Then I tried my World of Warcraft (WoW) patch download again (which is essentially a BitTorrent client) and stream Bohemian Rhapsody by the Muppets at HD quality from YouTube only to have my NIC go silent on me again. So, after the few hours of futzing with the router and its upgrade I was no closer to a proper solution. Although I did conclude it was, in fact, the Windows 7 box acting up since my WiFi connection as well as the Unix box on another LAN port could still use the network as it should.

Then the morning after I was looking around several Google results again and came to a post on the Windows7Forums.com website where someone had troubles with a wireless connection from Windows 7. I use a wired connection, so aside from the symptoms it’s not quite similar. It then documents the ‘roll back driver’ solution, which I had previously tried. But it became interesting when I found Sage’s post at the bottom which reads:

“I think I’ve found the solution to this problem. It was revealed recently (A week or two ago) that there is a bug in the NVIDIA chipsets when using 64-bit addressing. This ends up affecting a whole host of things on machines, including this nefarious “Random internet disconnect” problem. I posted this solution over at a couple other W7 forums and others with NVIDIA chipsets and 64-bit machines have all found it to succeed in fixing this frustrating issue.

What it more or less comes down to is applying this hotfix: You encounter problems when you move data over USB from a Windows 7 or Windows Server 2008 R2-based computer that has an NVIDIA USB EHCI chipset and at least 4GB of RAM

Ignore the fact that it mentions this fix to be solely for USB hardware issues. It is a fix for the NVIDIA chipset on 64-bit Windows 7 and has been practically a miracle fix for people with the USB harddrive disconnect problem, the random internet drop problem, and the internet-disconnect-on-wake-from-sleep problems that have all been plaguing Windows 7 64-Bit users since the RC.”

Funnily enough my Windows 7 is 64-bits and I also have an NVIDIA nForce chipset. Looking at the hotfix page shows it really is only updated USB driver files. Figuring it cannot possibly be worse than my situation now I installed the hotfix are being emailed the location to download it from. A reboot later I was downloading my WoW patch with the downloader while streaming the Muppets again and haven’t seen it drop dead yet. So initial tests show it might very well be the solution, but I need to stress test it some more.

# Windows 7 and the Windows Audio Service

Strange thing, after logging in my Windows 7 task tray suddenly showed my volume icon as a red cross and hovering over it said that the “Audio Service is not running”. Looking at the services by means of services.msc shows that my Creative Audio Service and Windows Audio Service are both running. Restarting the Windows Audio Service and Creative Audio Service fixed the display issue. Apparently just changing the volume ought to fix the display of the icon as well.

# Office 2010 Chinese language pack font list

It looks like the Chinese Office 2010 font list is the following (Changzhou SinoType, Founder, Microsoft, Stone):

• FZShuTi
• FZYaoTi
• LiSu
• Microsoft YaHei
• Microsoft YaHei Bold
• STCaiyun
• STFangsong
• STHupo
• STKaiti
• STLiti
• STSong
• STXihei
• STXingkai
• STXinwei
• STZhongsong
• YouYuan

From the language pack make sure to select 国际字体 (international fonts) and 校对工具 (proofing tools). Under 国际字体 we have 典型字体 (typical fonts) and under 校对工具 we have 简体中文校对工具 (Simplified Chinese proofing tools) and 英语校对工具 (English proofing tools).

# Office 2010 Japanese language pack font list

It looks like the Japanese Office 2010 font list is the following (all by RICOH):

• HGGothicE
• HGGothicM Medium
• HGGyoshotai Medium
• HGKyokashotai Medium
• HGMaruGothicMPRO
• HGMinchoB Bold
• HGMinchoE
• HGPGothicE
• HGPGothicM Medium
• HGPGyoshotai Medium
• HGPKyokashotai Medium
• HGPMinchoB Bold
• HGPMinchoE
• HGPSoeiKakugothicUB
• HGPSoeiKakupoptai
• HGPSoeiPresence EB Extra-Bold
• HGSeikaishotaiPRO
• HGSGothicE
• HGSGothicM Medium
• HGSGyoshotai Medium
• HGSKyokashotai Medium
• HGSMinchoB Bold
• HGSMinchoE
• HGSoeiKakugothicUB
• HGSoeiKakupoptai
• HGSoeiPresenceE Extra-Bold
• HGSSoeiKakugothicUB
• HGSSoeiKakupoptai
• HGSSoeiPresence EB Extra-Bold

# Office 2010 font list

It seems the Office 2010 font list is the following (English installation):

• Algerian
• Arial Unicode MS
• Bauhaus 93
• Bell MT
• Berlin Sans FB
• Bernard MT Condensed
• Bodoni MT Poster Compressed Light
• Book Antiqua
• Bookman Old Style
• Bookshelf Symbol 7
• Britannic Bold
• Brush Script MT Italic
• Californian FB
• Centaur
• Century Gothic
• Century
• Chiller
• Colonna MT
• Cooper Black
• Footlight MT Light
• Freestyle Script
• Garamond
• Haettenschweiler
• Harlow Solid Semi Expanded Italic
• Harrington
• High Tower Text
• Informal Roman
• Jokerman
• Juice ITC
• Kristen ITC
• Kunstler Script
• Latin Wide
• Lucide Bright
• Lucida Calligraphy Italic
• Lucida Fax
• Lucida Handwriting Italic
• Magneto Bold
• Matura MT Script Capitals
• Mistral
• Modern No. 20
• Modern
• Monotype Corsiva Italic
• MS Outlook
• MS Reference Sans Serif
• MS Reference Specialty
• MS Sans Serif
• MS Serif
• MT Extra
• Niagara Engraved
• Niagara Solid
• OCRB Regular
• Old English Text MT
• Onyx
• Parchment
• Playbill
• Poor Richard
• Ravie
• Roman
• Showcard Gothic
• Snap ITC
• Stencil
• Tempus Sans ITC
• Viner Hand ITC
• Vivaldi Italic
• Wingdings 2
• Wingdings 3

# Microsoft Office 2010, typography, and proofing tools

You can download language packs from the Microsoft Download Center. If you change the language to, say, Japanese you are presented with two download links at the bottom for the Japanese language pack. This language pack includes user interface changes for Japanese as well as proofing tools, OCR support, and fonts.

Once the pack is downloaded just run it and you can customize want you want to install. Since I am not interested in the UI aspects of the pack, I selected the top part and toggled selection for all to not install. Then for the entries 国際フォント (international fonts) and 文章校正ツール (proofing tools) I made sure to install everything. 文章校正ツール includes both 日本語用校正ツール and 英語用校正ツール and I guess you can most likely skip 英語用校正ツール since it is already installed. 国際フォント includes 標準フォント (standards font), which I am guessing is related to JIS X standards for font encodings.

Basic Windows 7 has 134 fonts installed. A basic English Office 2010 install increases this to 198 fonts installed. Installing the Japanese language pack proofing tools with fonts brings this to 228 fonts installed.

If you press the expansion arrow at the bottom-right of the Home part of the ribbon (or press CTRL-D) you will get the Font dialog. If you select the Advanced tab you can turn on features such as OpenType ligatures. This will mean that with text such as ‘fl’ or ‘ffi’ certain parts of the letters will connect instead of showing white space between the letters. This is the same technique used in printed media such as books.

Update: Michael Hendry was kind enough to point out that I was mistaking 標準 with (standard/default) with 基準 (standards/JIS/ISO).