aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-05-14 14:13:13 +1000
committerNeil <nyamatongwe@gmail.com>2018-05-14 14:13:13 +1000
commitc4aa7826f3d2178e39e5bff2f6886d7d3d3f46d7 (patch)
treee5f93f314c700da99e6c54f590d034645c73a111
parent3fc8c97d80a6797e60e6b203c9b4aa9d553df8a7 (diff)
downloadscintilla-mirror-c4aa7826f3d2178e39e5bff2f6886d7d3d3f46d7.tar.gz
Modernize Platform.h (3) - update Surface to delete WidthChar, use size_t for
Polygon and delete the standard copy and assignment methods.
-rw-r--r--cocoa/PlatCocoa.h3
-rw-r--r--cocoa/PlatCocoa.mm15
-rw-r--r--gtk/PlatGTK.cxx22
-rw-r--r--include/Platform.h13
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp12
-rw-r--r--qt/ScintillaEditBase/PlatQt.h3
-rw-r--r--src/CallTip.cxx4
-rw-r--r--src/Indicator.cxx2
-rw-r--r--src/LineMarker.cxx13
-rw-r--r--src/ViewStyle.cxx5
-rw-r--r--win32/PlatWin.cxx41
11 files changed, 37 insertions, 96 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h
index d6f2bf449..aafcf67bb 100644
--- a/cocoa/PlatCocoa.h
+++ b/cocoa/PlatCocoa.h
@@ -87,7 +87,7 @@ public:
int DeviceHeightFont(int points) override;
void MoveTo(int x_, int y_) override;
void LineTo(int x_, int y_) override;
- void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back) override;
+ void Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override;
void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void FillRectangle(PRectangle rc, ColourDesired back) override;
void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
@@ -104,7 +104,6 @@ public:
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override;
void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) override;
XYPOSITION WidthText(Font &font_, const char *s, int len) override;
- XYPOSITION WidthChar(Font &font_, char ch) override;
XYPOSITION Ascent(Font &font_) override;
XYPOSITION Descent(Font &font_) override;
XYPOSITION InternalLeading(Font &font_) override;
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 704645cb6..9f04870c2 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -376,12 +376,12 @@ void SurfaceImpl::LineTo(int x_, int y_) {
//--------------------------------------------------------------------------------------------------
-void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourDesired fore,
+void SurfaceImpl::Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore,
ColourDesired back) {
// Allocate memory for the array of points.
std::vector<CGPoint> points(npts);
- for (int i = 0; i < npts; i++) {
+ for (size_t i = 0; i < npts; i++) {
// Quartz floating point issues: plot the MIDDLE of the pixels
points[i].x = pts[i].x + 0.5;
points[i].y = pts[i].y + 0.5;
@@ -925,17 +925,6 @@ XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
return 1;
}
-XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) {
- char str[2] = { ch, '\0' };
- if (font_.GetID()) {
- CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_));
- textLayout->setText(str, 1, encoding, *TextStyleFromFont(font_));
-
- return textLayout->MeasureStringWidth();
- } else
- return 1;
-}
-
// This string contains a good range of characters to test for size.
const char sizeString[] = "`~!@#$%^&*()-_=+\\|[]{};:\"\'<,>.?/1234567890"
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx
index 622936877..554128477 100644
--- a/gtk/PlatGTK.cxx
+++ b/gtk/PlatGTK.cxx
@@ -154,7 +154,7 @@ public:
int DeviceHeightFont(int points) override;
void MoveTo(int x_, int y_) override;
void LineTo(int x_, int y_) override;
- void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) override;
+ void Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override;
void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void FillRectangle(PRectangle rc, ColourDesired back) override;
void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
@@ -171,7 +171,6 @@ public:
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override;
void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) override;
XYPOSITION WidthText(Font &font_, const char *s, int len) override;
- XYPOSITION WidthChar(Font &font_, char ch) override;
XYPOSITION Ascent(Font &font_) override;
XYPOSITION Descent(Font &font_) override;
XYPOSITION InternalLeading(Font &font_) override;
@@ -426,12 +425,12 @@ void SurfaceImpl::LineTo(int x_, int y_) {
y = y_;
}
-void SurfaceImpl::Polygon(Point *pts, int npts, ColourDesired fore,
+void SurfaceImpl::Polygon(Point *pts, size_t npts, ColourDesired fore,
ColourDesired back) {
PLATFORM_ASSERT(context);
PenColour(back);
cairo_move_to(context, pts[0].x + 0.5, pts[0].y + 0.5);
- for (int i = 1; i < npts; i++) {
+ for (size_t i = 1; i < npts; i++) {
cairo_line_to(context, pts[i].x + 0.5, pts[i].y + 0.5);
}
cairo_close_path(context);
@@ -500,7 +499,7 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi
Point(rc.left, rc.bottom - 2),
Point(rc.left, rc.top + 2),
};
- Polygon(pts, ELEMENTS(pts), fore, back);
+ Polygon(pts, std::size(pts), fore, back);
} else {
RectangleDraw(rc, fore, back);
}
@@ -866,17 +865,6 @@ XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) {
}
}
-XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) {
- if (font_.GetID()) {
- if (PFont(font_)->pfd) {
- return WidthText(font_, &ch, 1);
- }
- return 1;
- } else {
- return 1;
- }
-}
-
// Ascent and descent determined by Pango font metrics.
XYPOSITION SurfaceImpl::Ascent(Font &font_) {
@@ -918,7 +906,7 @@ XYPOSITION SurfaceImpl::Height(Font &font_) {
}
XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) {
- return WidthChar(font_, 'n');
+ return WidthText(font_, "n", 1);
}
void SurfaceImpl::SetClip(PRectangle rc) {
diff --git a/include/Platform.h b/include/Platform.h
index d020db883..f50aca431 100644
--- a/include/Platform.h
+++ b/include/Platform.h
@@ -257,12 +257,12 @@ public:
* A surface abstracts a place to draw.
*/
class Surface {
-private:
- // Private so Surface objects can not be copied
- Surface(const Surface &) {}
- Surface &operator=(const Surface &) { return *this; }
public:
- Surface() {}
+ Surface() noexcept = default;
+ Surface(const Surface &) = delete;
+ Surface(Surface &&) = delete;
+ Surface &operator=(const Surface &) = delete;
+ Surface &operator=(Surface &&) = delete;
virtual ~Surface() {}
static Surface *Allocate(int technology);
@@ -277,7 +277,7 @@ public:
virtual int DeviceHeightFont(int points)=0;
virtual void MoveTo(int x_, int y_)=0;
virtual void LineTo(int x_, int y_)=0;
- virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back)=0;
+ virtual void Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back)=0;
virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back)=0;
virtual void FillRectangle(PRectangle rc, ColourDesired back)=0;
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
@@ -293,7 +293,6 @@ public:
virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0;
virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0;
virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0;
- virtual XYPOSITION WidthChar(Font &font_, char ch)=0;
virtual XYPOSITION Ascent(Font &font_)=0;
virtual XYPOSITION Descent(Font &font_)=0;
virtual XYPOSITION InternalLeading(Font &font_)=0;
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index ac8fbc9cc..26890e4b7 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -269,7 +269,7 @@ void SurfaceImpl::LineTo(int x_, int y_)
}
void SurfaceImpl::Polygon(Point *pts,
- int npts,
+ size_t npts,
ColourDesired fore,
ColourDesired back)
{
@@ -277,11 +277,11 @@ void SurfaceImpl::Polygon(Point *pts,
BrushColour(back);
std::vector<QPoint> qpts(npts);
- for (int i = 0; i < npts; i++) {
+ for (size_t i = 0; i < npts; i++) {
qpts[i] = QPoint(pts[i].x, pts[i].y);
}
- GetPainter()->drawPolygon(&qpts[0], npts);
+ GetPainter()->drawPolygon(&qpts[0], static_cast<int>(npts));
}
void SurfaceImpl::RectangleDraw(PRectangle rc,
@@ -494,12 +494,6 @@ XYPOSITION SurfaceImpl::WidthText(Font &font, const char *s, int len)
return metrics.width(string);
}
-XYPOSITION SurfaceImpl::WidthChar(Font &font, char ch)
-{
- QFontMetricsF metrics(*FontPointer(font), device);
- return metrics.width(ch);
-}
-
XYPOSITION SurfaceImpl::Ascent(Font &font)
{
QFontMetricsF metrics(*FontPointer(font), device);
diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h
index 00a9645ef..07da76682 100644
--- a/qt/ScintillaEditBase/PlatQt.h
+++ b/qt/ScintillaEditBase/PlatQt.h
@@ -80,7 +80,7 @@ public:
int DeviceHeightFont(int points) override;
void MoveTo(int x_, int y_) override;
void LineTo(int x_, int y_) override;
- void Polygon(Point *pts, int npts, ColourDesired fore,
+ void Polygon(Point *pts, size_t npts, ColourDesired fore,
ColourDesired back) override;
void RectangleDraw(PRectangle rc, ColourDesired fore,
ColourDesired back) override;
@@ -105,7 +105,6 @@ public:
void MeasureWidths(Font &font, const char *s, int len,
XYPOSITION *positions) override;
XYPOSITION WidthText(Font &font, const char *s, int len) override;
- XYPOSITION WidthChar(Font &font, char ch) override;
XYPOSITION Ascent(Font &font) override;
XYPOSITION Descent(Font &font) override;
XYPOSITION InternalLeading(Font &font) override;
diff --git a/src/CallTip.cxx b/src/CallTip.cxx
index 1b40c185d..2eab1146f 100644
--- a/src/CallTip.cxx
+++ b/src/CallTip.cxx
@@ -135,14 +135,14 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
Point::FromInts(centreX + halfWidth, centreY + quarterWidth),
Point::FromInts(centreX, centreY - halfWidth + quarterWidth),
};
- surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
+ surface->Polygon(pts, std::size(pts), colourBG, colourBG);
} else { // Down arrow
Point pts[] = {
Point::FromInts(centreX - halfWidth, centreY - quarterWidth),
Point::FromInts(centreX + halfWidth, centreY - quarterWidth),
Point::FromInts(centreX, centreY + halfWidth - quarterWidth),
};
- surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG);
+ surface->Polygon(pts, std::size(pts), colourBG, colourBG);
}
}
offsetMain = xEnd;
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 0df7d7776..91f98ac58 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -190,7 +190,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
Point(ix + pixelHeight, iy + pixelHeight), // Right
Point(ix, iy) // Top
};
- surface->Polygon(pts, 3, sacDraw.fore, sacDraw.fore);
+ surface->Polygon(pts, std::size(pts), sacDraw.fore, sacDraw.fore);
}
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(irc.left, ymid);
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 6f1e4b01a..a2f7e299e 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -19,7 +19,6 @@
#include "Scintilla.h"
-#include "StringCopy.h"
#include "IntegerRectangle.h"
#include "XPM.h"
#include "LineMarker.h"
@@ -186,7 +185,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
Point::FromInts(centreX - dimOn4, centreY + dimOn2),
Point::FromInts(centreX + dimOn2 - dimOn4, centreY),
};
- surface->Polygon(pts, ELEMENTS(pts), fore, back);
+ surface->Polygon(pts, std::size(pts), fore, back);
} else if (markType == SC_MARK_ARROWDOWN) {
Point pts[] = {
@@ -194,7 +193,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
Point::FromInts(centreX + dimOn2, centreY - dimOn4),
Point::FromInts(centreX, centreY + dimOn2 - dimOn4),
};
- surface->Polygon(pts, ELEMENTS(pts), fore, back);
+ surface->Polygon(pts, std::size(pts), fore, back);
} else if (markType == SC_MARK_PLUS) {
Point pts[] = {
@@ -211,7 +210,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
Point::FromInts(centreX - 1, centreY + 1),
Point::FromInts(centreX - armSize, centreY + 1),
};
- surface->Polygon(pts, ELEMENTS(pts), fore, back);
+ surface->Polygon(pts, std::size(pts), fore, back);
} else if (markType == SC_MARK_MINUS) {
Point pts[] = {
@@ -220,7 +219,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
Point::FromInts(centreX + armSize, centreY +1),
Point::FromInts(centreX - armSize, centreY + 1),
};
- surface->Polygon(pts, ELEMENTS(pts), fore, back);
+ surface->Polygon(pts, std::size(pts), fore, back);
} else if (markType == SC_MARK_SMALLRECT) {
PRectangle rcSmall;
@@ -416,7 +415,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
Point::FromInts(centreX, centreY + dimOn4),
Point::FromInts(centreX, centreY + dimOn2),
};
- surface->Polygon(pts, ELEMENTS(pts), fore, back);
+ surface->Polygon(pts, std::size(pts), fore, back);
} else if (markType == SC_MARK_LEFTRECT) {
PRectangle rcLeft = rcWhole;
rcLeft.right = rcLeft.left + 4;
@@ -430,7 +429,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
Point::FromInts(ircWhole.right - 3, centreY + halfHeight),
Point::FromInts(ircWhole.left, centreY + halfHeight),
};
- surface->Polygon(pts, ELEMENTS(pts), fore, back);
+ surface->Polygon(pts, std::size(pts), fore, back);
} else { // SC_MARK_FULLRECT
surface->FillRectangle(rcWhole, back);
}
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 8a27f8bf2..1a95450ce 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -80,7 +80,7 @@ void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, cons
descent = static_cast<unsigned int>(surface.Descent(font));
capitalHeight = surface.Ascent(font) - surface.InternalLeading(font);
aveCharWidth = surface.AverageCharWidth(font);
- spaceWidth = surface.WidthChar(font, ' ');
+ spaceWidth = surface.WidthText(font, " ", 1);
}
ViewStyle::ViewStyle() : markers(MARKER_MAX + 1), indicators(INDIC_MAX + 1) {
@@ -366,7 +366,8 @@ void ViewStyle::Refresh(Surface &surface, int tabInChars) {
controlCharWidth = 0.0;
if (controlCharSymbol >= 32) {
- controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast<char>(controlCharSymbol));
+ const char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
+ controlCharWidth = surface.WidthText(styles[STYLE_CONTROLCHAR].font, cc, 1);
}
CalculateMarginWidthAndMask();
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 4c57fd133..5bff083e3 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -554,7 +554,7 @@ public:
int DeviceHeightFont(int points) override;
void MoveTo(int x_, int y_) override;
void LineTo(int x_, int y_) override;
- void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) override;
+ void Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override;
void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void FillRectangle(PRectangle rc, ColourDesired back) override;
void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
@@ -571,7 +571,6 @@ public:
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override;
void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) override;
XYPOSITION WidthText(Font &font_, const char *s, int len) override;
- XYPOSITION WidthChar(Font &font_, char ch) override;
XYPOSITION Ascent(Font &font_) override;
XYPOSITION Descent(Font &font_) override;
XYPOSITION InternalLeading(Font &font_) override;
@@ -720,15 +719,15 @@ void SurfaceGDI::LineTo(int x_, int y_) {
::LineTo(hdc, x_, y_);
}
-void SurfaceGDI::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) {
+void SurfaceGDI::Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back) {
PenColour(fore);
BrushColor(back);
std::vector<POINT> outline;
- for (int i=0; i<npts; i++) {
+ for (size_t i=0; i<npts; i++) {
POINT pt = {static_cast<LONG>(pts[i].x), static_cast<LONG>(pts[i].y)};
outline.push_back(pt);
}
- ::Polygon(hdc, &outline[0], npts);
+ ::Polygon(hdc, &outline[0], static_cast<int>(npts));
}
void SurfaceGDI::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) {
@@ -1009,13 +1008,6 @@ void SurfaceGDI::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *
std::fill(positions+i, positions + len, lastPos);
}
-XYPOSITION SurfaceGDI::WidthChar(Font &font_, char ch) {
- SetFont(font_);
- SIZE sz;
- ::GetTextExtentPoint32A(hdc, &ch, 1, &sz);
- return static_cast<XYPOSITION>(sz.cx);
-}
-
XYPOSITION SurfaceGDI::Ascent(Font &font_) {
SetFont(font_);
TEXTMETRIC tm;
@@ -1123,7 +1115,7 @@ public:
int DeviceHeightFont(int points) override;
void MoveTo(int x_, int y_) override;
void LineTo(int x_, int y_) override;
- void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) override;
+ void Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override;
void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void FillRectangle(PRectangle rc, ColourDesired back) override;
void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
@@ -1140,7 +1132,6 @@ public:
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore) override;
void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions) override;
XYPOSITION WidthText(Font &font_, const char *s, int len) override;
- XYPOSITION WidthChar(Font &font_, char ch) override;
XYPOSITION Ascent(Font &font_) override;
XYPOSITION Descent(Font &font_) override;
XYPOSITION InternalLeading(Font &font_) override;
@@ -1354,7 +1345,7 @@ void SurfaceD2D::LineTo(int x_, int y_) {
}
}
-void SurfaceD2D::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) {
+void SurfaceD2D::Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back) {
if (pRenderTarget) {
ID2D1Factory *pFactory = 0;
pRenderTarget->GetFactory(&pFactory);
@@ -1365,7 +1356,7 @@ void SurfaceD2D::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired
hr = geometry->Open(&sink);
if (SUCCEEDED(hr)) {
sink->BeginFigure(D2D1::Point2F(pts[0].x + 0.5f, pts[0].y + 0.5f), D2D1_FIGURE_BEGIN_FILLED);
- for (int i=1; i<npts; i++) {
+ for (size_t i=1; i<npts; i++) {
sink->AddLine(D2D1::Point2F(pts[i].x + 0.5f, pts[i].y + 0.5f));
}
sink->EndFigure(D2D1_FIGURE_END_CLOSED);
@@ -1698,24 +1689,6 @@ void SurfaceD2D::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *
}
}
-XYPOSITION SurfaceD2D::WidthChar(Font &font_, char ch) {
- FLOAT width = 1.0;
- SetFont(font_);
- if (pIDWriteFactory && pTextFormat) {
- // Create a layout
- IDWriteTextLayout *pTextLayout = 0;
- const WCHAR wch = ch;
- const HRESULT hr = pIDWriteFactory->CreateTextLayout(&wch, 1, pTextFormat, 1000.0, 1000.0, &pTextLayout);
- if (SUCCEEDED(hr)) {
- DWRITE_TEXT_METRICS textMetrics;
- if (SUCCEEDED(pTextLayout->GetMetrics(&textMetrics)))
- width = textMetrics.widthIncludingTrailingWhitespace;
- pTextLayout->Release();
- }
- }
- return width;
-}
-
XYPOSITION SurfaceD2D::Ascent(Font &font_) {
SetFont(font_);
return ceil(yAscent);