summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorBrandon Schaefer <brandontschaefer@gmail.com>2014-01-29 14:40:20 -0800
committerBrandon Schaefer <brandontschaefer@gmail.com>2014-01-29 14:40:20 -0800
commit46af0276e875dd5be5b83ad6e23150d79ee8e78a (patch)
treeba19919cc15de213f938822327feb9a49fc51991 /unity-shared
parentebe9a6e8c8530a2d4a7f0f811f07b55230f598b1 (diff)
* Add a simple Pt to Px function to the EMConverter
(bzr r3632.2.1)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/EMConverter.cpp5
-rw-r--r--unity-shared/EMConverter.h4
2 files changed, 8 insertions, 1 deletions
diff --git a/unity-shared/EMConverter.cpp b/unity-shared/EMConverter.cpp
index fa67834e8..42d50449a 100644
--- a/unity-shared/EMConverter.cpp
+++ b/unity-shared/EMConverter.cpp
@@ -36,6 +36,11 @@ EMConverter::EMConverter(int font_size, double dpi)
UpdateBasePixelsPerEM();
}
+double EMConverter::PtToPx(int pt)
+{
+ return pt * dpi_ / PIXELS_PER_INCH;
+}
+
void EMConverter::UpdatePixelsPerEM()
{
pixels_per_em_ = font_size_ * dpi_ / PIXELS_PER_INCH;
diff --git a/unity-shared/EMConverter.h b/unity-shared/EMConverter.h
index 739ce713a..0c5bc1b06 100644
--- a/unity-shared/EMConverter.h
+++ b/unity-shared/EMConverter.h
@@ -26,7 +26,7 @@ namespace unity
class EMConverter
{
public:
- EMConverter(int font_size, double dpi = 96.0);
+ EMConverter(int font_size = 0, double dpi = 96.0);
void SetFontSize(int font_size);
void SetDPI(double dpi);
@@ -37,6 +37,8 @@ public:
int ConvertPixels(int pixels) const;
double DPIScale() const;
+ double PtToPx(int pt);
+
private:
void UpdatePixelsPerEM();
void UpdateBasePixelsPerEM();