[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Make Non-ASCII font names work in editing log messages

From: Kazutoshi Satoda <k_satoda_at_f2.dion.ne.jp>
Date: 2006-08-08 21:14:25 CEST


I had been wondering for a long time, why a proportional font is used
in commit dialogs even if I select a fixed font as "Font for log
messages" and actually that font is used in log dialogs. This problem
spoils the use of tsvn:logwidthmarker for me.

The attached patch will fix the problem. But sorry again, I can't
build tsvn by myself. And I think that this problem will not be
reproduced because many people use only ASCII font names. So I will
try to explain the problem in detail. Please read the following before
applying the patch. If you agree that the patch will fix the problem,
apply it. I'm happy if this fix is merged into the 1.4.x branch.

CSciEdit::SetFont() converts the font name in CString to CStringA
via StringForControl() that uses the codepage of the control. Since
the control's codepage is set as SC_CP_UTF8 in CSciEdit::Init(),
StringForControl() will use UTF8 as the codepage argument for
WideCharToMultiByte(). And the result is used as LOGFONT::lfFaceName.
(See SetLogFont() in scintilla/win32/PlatWin.cxx.) The problem is that
CreateFontIndirect() does not work with UTF8(at least in Japanese
locale). Probably, it treats LOGFONT::lfFaceName as MBCS in system
default codepage. Then, CSciEdit::SetFont() should convert the
font name with system default codepage. The cast to CStringA does it.

After writing the above, I found a workaround. Changing "Font for
log messages", by regedit, from localized font name to alternative
English(ASCII) name shows the expected result(a fixed font is used
in commit dialogs). But after that, the setting dialog shows
incorrect font name in the combo box.


Index: src/Utils/MiscUI/SciEdit.cpp
--- src/Utils/MiscUI/SciEdit.cpp (revision 7230)
+++ src/Utils/MiscUI/SciEdit.cpp (working copy)
@@ -363,7 +363,7 @@
 void CSciEdit::SetFont(CString sFontName, int iFontSizeInPoints)
         Call(SCI_STYLESETSIZE, STYLE_DEFAULT, iFontSizeInPoints);
         // set the styles for the bug ID strings

To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Tue Aug 8 21:14:51 2006

This is an archived mail posted to the TortoiseSVN Dev mailing list.