fix tastudio font bugs, some mine, some not mine

This commit is contained in:
zeromus 2016-04-17 03:07:07 -05:00
parent 1bde0c5a72
commit 5a6ffe022a
3 changed files with 19 additions and 11 deletions

View File

@ -147,17 +147,15 @@ namespace BizHawk.Client.EmuHawk.CustomControls
public static IntPtr CreateRotatedHFont(Font font, bool CW)
{
LOGFONT logf = new LOGFONT();
//font.ToLogFont(logf);
//logf.lfEscapement = CW ? 2700 : 900;
logf.lfFaceName = "System";
logf.lfEscapement = 3600 - 450;
font.ToLogFont(logf);
logf.lfEscapement = CW ? 2700 : 900;
logf.lfOrientation = logf.lfEscapement;
logf.lfOutPrecision = (byte)FontPrecision.OUT_TT_ONLY_PRECIS;
//this doesnt work! .net erases the relevant propreties.. it seems?
//return Font.FromLogFont(logf);
var ret = CreateFontIndirect(ref logf);
var ret = CreateFontIndirect(logf);
return ret;
}
@ -334,8 +332,10 @@ namespace BizHawk.Client.EmuHawk.CustomControls
[DllImport("user32.dll")]
private static extern IntPtr EndPaint(IntPtr hWnd, IntPtr lpPaint);
[DllImport("gdi32.dll")]
static extern IntPtr CreateFontIndirect([In] ref LOGFONT lplf);
[DllImport("gdi32.dll", CharSet = CharSet.Auto)]
private static extern IntPtr CreateFontIndirect(
[In, MarshalAs(UnmanagedType.LPStruct)]LOGFONT lplf
);
[DllImport("gdi32.dll")]
private static extern int Rectangle(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);

View File

@ -103,7 +103,7 @@ namespace BizHawk.Client.EmuHawk
{
int start = -VBar.Value;
Gdi.PrepDrawString(RotatedFont, _foreColor);
Gdi.PrepDrawString(NormalFont, _foreColor);
foreach (var column in visibleColumns)
{
@ -190,15 +190,23 @@ namespace BizHawk.Client.EmuHawk
var point = new Point(x + strOffsetX, y + strOffsetY);
var rePrep = false;
if(j==1)
if (SelectedItems.Contains(new Cell { Column = visibleColumns[j], RowIndex = i + startRow }))
{
Gdi.PrepDrawString(NormalFont, SystemColors.HighlightText);
Gdi.PrepDrawString(RotatedFont, SystemColors.HighlightText);
rePrep = true;
}
else if (j == 1)
{
//1. not sure about this; 2. repreps may be excess, but if we render one column at a time, we do need to change back after rendering the header
rePrep = true;
Gdi.PrepDrawString(RotatedFont, _foreColor);
}
if (!string.IsNullOrWhiteSpace(text))
{
{
Gdi.DrawString(text, point);
}

View File

@ -65,7 +65,7 @@ namespace BizHawk.Client.EmuHawk
// PrepDrawString doesn't actually set the font, so this is rather useless.
// I'm leaving this stuff as-is so it will be a bit easier to fix up with another rendering method.
RotatedFont = GDIRenderer.CreateRotatedHFont(Font, true);
RotatedFont = GDIRenderer.CreateRotatedHFont(NormalFont, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);