From b510d1fe619eff95c7e0d0a88421b8e3cad8f729 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 7 Aug 2011 13:41:35 +1000 Subject: Implement APIs for fractional font sizes and a range of weights. --- src/ViewStyle.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ViewStyle.cxx') diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 9ba69b1ce..b46cd9eb4 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -88,12 +88,12 @@ FontRealised::~FontRealised() { void FontRealised::Realise(Surface &surface, int zoomLevel) { PLATFORM_ASSERT(fontName); - sizeZoomed = size + zoomLevel; - if (sizeZoomed <= 2) // Hangs if sizeZoomed <= 1 - sizeZoomed = 2; + sizeZoomed = size + zoomLevel * SC_FONT_SIZE_MULTIPLIER; + if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 + sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; int deviceHeight = surface.DeviceHeightFont(sizeZoomed); - font.Create(fontName, characterSet, deviceHeight, bold, italic, extraFontFlag); + font.Create(fontName, characterSet, deviceHeight, weight, italic, extraFontFlag); ascent = surface.Ascent(font); descent = surface.Descent(font); @@ -457,9 +457,9 @@ void ViewStyle::EnsureStyle(size_t index) { void ViewStyle::ResetDefaultStyle() { styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0), ColourDesired(0xff,0xff,0xff), - Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()), + Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, fontNames.Save(Platform::DefaultFont()), SC_CHARSET_DEFAULT, - false, false, false, false, Style::caseMixed, true, true, false); + SC_WEIGHT_NORMAL, false, false, false, Style::caseMixed, true, true, false); } void ViewStyle::ClearStyles() { -- cgit v1.2.3 From 113e4a09052842f129114abc7350f72401cd1198 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sun, 7 Aug 2011 14:18:37 +1000 Subject: Move scaling of font to pixels up into platform-independent code. --- src/ViewStyle.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ViewStyle.cxx') diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index b46cd9eb4..b722f8d02 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -92,8 +92,8 @@ void FontRealised::Realise(Surface &surface, int zoomLevel) { if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; - int deviceHeight = surface.DeviceHeightFont(sizeZoomed); - font.Create(fontName, characterSet, deviceHeight, weight, italic, extraFontFlag); + float deviceHeight = surface.DeviceHeightFont(sizeZoomed); + font.Create(fontName, characterSet, deviceHeight / SC_FONT_SIZE_MULTIPLIER, weight, italic, extraFontFlag); ascent = surface.Ascent(font); descent = surface.Descent(font); -- cgit v1.2.3 From 6860b289d19541ccb8d5be31c81c0f1aa992e9d7 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 10 Aug 2011 23:56:59 +1000 Subject: Implement 'technology' concept which will allow GDI and Direct2D/DirectWrite to run at the same time for different windows and operations. --- src/ViewStyle.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/ViewStyle.cxx') diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index b722f8d02..08164f648 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -86,14 +86,15 @@ FontRealised::~FontRealised() { frNext = 0; } -void FontRealised::Realise(Surface &surface, int zoomLevel) { +void FontRealised::Realise(Surface &surface, int zoomLevel, int technology) { PLATFORM_ASSERT(fontName); sizeZoomed = size + zoomLevel * SC_FONT_SIZE_MULTIPLIER; if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; float deviceHeight = surface.DeviceHeightFont(sizeZoomed); - font.Create(fontName, characterSet, deviceHeight / SC_FONT_SIZE_MULTIPLIER, weight, italic, extraFontFlag); + FontParameters fp(fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, weight, italic, extraFontFlag, technology, characterSet); + font.Create(fp); ascent = surface.Ascent(font); descent = surface.Descent(font); @@ -102,7 +103,7 @@ void FontRealised::Realise(Surface &surface, int zoomLevel) { aveCharWidth = surface.AverageCharWidth(font); spaceWidth = surface.WidthChar(font, ' '); if (frNext) { - frNext->Realise(surface, zoomLevel); + frNext->Realise(surface, zoomLevel, technology); } } @@ -239,6 +240,7 @@ void ViewStyle::Init(size_t stylesSize_) { indicators[2].under = false; indicators[2].fore = ColourDesired(0xff, 0, 0); + technology = SC_TECHNOLOGY_DEFAULT; lineHeight = 1; maxAscent = 1; maxDescent = 1; @@ -388,7 +390,7 @@ void ViewStyle::Refresh(Surface &surface) { CreateFont(styles[j]); } - frFirst->Realise(surface, zoomLevel); + frFirst->Realise(surface, zoomLevel, technology); for (unsigned int k=0; kFind(styles[k]); -- cgit v1.2.3