Commit ed04ffce authored by coppro's avatar coppro

Fixed GTK GetTextExtent bug

Added resources shell script
parent 0c454b4b
#! /bin/bash
rm -r /usr/local/share/magicseteditor/resource
for DIR in /usr/local/share/magicseteditor /usr/local/share/magicseteditor/resource /usr/local/share/magicseteditor/resource/icon /usr/local/share/magicseteditor/resource/tool /usr/local/share/magicseteditor/resource/cursor
do
if [ -d $DIR ]; then
: ;
elif [ -a $DIR ]; then
echo $DIR "exists and is not a directory!";
exit 1 ;
else
mkdir $DIR;
fi
done
cp src/resource/common/* /usr/local/share/magicseteditor/resource;
cp src/resource/msw/tool/* /usr/local/share/magicseteditor/resource/tool;
cp src/resource/msw/icon/* /usr/local/share/magicseteditor/resource/icon;
cp src/resource/msw/cursor/* /usr/local/share/magicseteditor/resource/cursor;
cp src/resource/msw/other/* /usr/local/share/magicseteditor/resource;
\ No newline at end of file
...@@ -457,6 +457,12 @@ void TextValueEditor::showCaret() { ...@@ -457,6 +457,12 @@ void TextValueEditor::showCaret() {
dc.SetFont(style().font.toWxFont(1.0)); dc.SetFont(style().font.toWxFont(1.0));
int hi; int hi;
dc.GetTextExtent(_(" "), 0, &hi); dc.GetTextExtent(_(" "), 0, &hi);
#ifdef __WXGTK__
// HACK: Some fonts don't get the descender height set correctly.
int charHeight = dc.GetCharHeight();
if (charHeight != hi)
hi += hi - charHeight;
#endif
cursor.height = rot.trS(hi); cursor.height = rot.trS(hi);
} }
} }
......
...@@ -235,10 +235,13 @@ double RotatedDC::getFontSizeStep() const { ...@@ -235,10 +235,13 @@ double RotatedDC::getFontSizeStep() const {
} }
RealSize RotatedDC::GetTextExtent(const String& text) const { RealSize RotatedDC::GetTextExtent(const String& text) const {
int w, h, descend; int w, h;
dc.GetTextExtent(text, &w, &h, &descend); dc.GetTextExtent(text, &w, &h);
#ifdef __WXGTK__ #ifdef __WXGTK__
h += descend; /// wxGTK seems to think character height does not include the descender. // HACK: Some fonts don't get the descender height set correctly.
int charHeight = dc.GetCharHeight();
if (charHeight != h)
h += h - charHeight;
#endif #endif
if (quality == QUALITY_LOW) { if (quality == QUALITY_LOW) {
return RealSize(w,h) / zoom; return RealSize(w,h) / zoom;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment