{"id":34173,"date":"2005-09-15T10:00:23","date_gmt":"2005-09-15T10:00:23","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2005\/09\/15\/fiddling-with-the-fonts-part-1-making-the-chinese-characters-larger\/"},"modified":"2005-09-15T10:00:23","modified_gmt":"2005-09-15T10:00:23","slug":"fiddling-with-the-fonts-part-1-making-the-chinese-characters-larger","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20050915-23\/?p=34173","title":{"rendered":"Fiddling with the fonts, part 1: Making the Chinese characters larger"},"content":{"rendered":"<p><P>\nLet&#8217;s pay a quick visit to our continuing dictionary project.\nOne of the things you may have noticed is that the Chinese\ncharacters are unreadably small.\nLet&#8217;s fix that by making them larger.\n<\/P>\n<PRE>\nclass RootWindow : public Window\n{\npublic:\n virtual LPCTSTR ClassName() { return TEXT(&#8220;Scratch&#8221;); }\n static RootWindow *Create();\n <FONT COLOR=\"blue\">RootWindow();\n ~RootWindow();<\/FONT>\n &#8230;\nprivate:\n HWND m_hwndLV;\n HWND m_hwndEdit;\n HWND m_hwndLastFocus;\n <FONT COLOR=\"blue\">HFONT m_hfChinese;<\/FONT>\n int  m_cyEdit;\n &#8230;\n}<\/p>\n<p><FONT COLOR=\"blue\">RootWindow::RootWindow()\n : m_hfChinese(NULL)\n{\n}<\/p>\n<p>RootWindow::~RootWindow()\n{\n if (m_hfChinese) DeleteObject(m_hfChinese);\n}<\/FONT><\/p>\n<p>LRESULT RootWindow::OnCreate()\n{\n &#8230;\n ListView_SetExtendedListViewStyleEx(m_hwndLV,\n                                     LVS_EX_FULLROWSELECT,\n                                     LVS_EX_FULLROWSELECT);<\/p>\n<p> <FONT COLOR=\"blue\">LOGFONT lf;\n if (!GetObject(GetWindowFont(m_hwndLV), sizeof(lf), &amp;lf)) {\n  return -1;\n }\n lf.lfHeight += lf.lfHeight \/ 2; \/\/ 50% bigger\n m_hfChinese = CreateFontIndirect(&amp;lf);\n if (!m_hfChinese) return -1;\n SetWindowFont(m_hwndLV, m_hfChinese, FALSE);<\/FONT><\/p>\n<p> LVCOLUMN lvc;\n &#8230;\n}\n<\/PRE>\n<P>\nThis magnifies the font in the list view by 50%\nby taking the current font, increasing the height,\nand creating a new font, which we select into the list view.\n<\/P>\n<P>\nThis works in that the font is indeed bigger,\nbut it&#8217;s bigger even for the English part,\nand that larger-than-normal English font looks kind of\nout of place.\nThe English was perfectly fine at its original size, after all.\nIt was only the Chinese we wanted to enlarge.\n(This will become more important later on when we turn the\nprogram into a dynamic translator.)\n<\/P>\n<P>\nWe&#8217;ll look at this problem next time.\n<\/P>\n<P>\n[Raymond is currently away; this message was pre-recorded.]\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s pay a quick visit to our continuing dictionary project. One of the things you may have noticed is that the Chinese characters are unreadably small. Let&#8217;s fix that by making them larger. class RootWindow : public Window { public: virtual LPCTSTR ClassName() { return TEXT(&#8220;Scratch&#8221;); } static RootWindow *Create(); RootWindow(); ~RootWindow(); &#8230; private: HWND [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-34173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>Let&#8217;s pay a quick visit to our continuing dictionary project. One of the things you may have noticed is that the Chinese characters are unreadably small. Let&#8217;s fix that by making them larger. class RootWindow : public Window { public: virtual LPCTSTR ClassName() { return TEXT(&#8220;Scratch&#8221;); } static RootWindow *Create(); RootWindow(); ~RootWindow(); &#8230; private: HWND [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/34173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=34173"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/34173\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=34173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=34173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=34173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}