VIZ++ Class: OpenGLOutlineFont
|
Source code
/*
* OpenGLOutlineFont.h
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// Note:
// The wglUseFontOutlines function works with TrueType fonts only.
// See https://msdn.microsoft.com/en-us/library/windows/desktop/dd374393(v=vs.85).aspx
#pragma once
#include <viz++/opengl/OpenGLFont.h>
namespace VIZ {
class OpenGLOutlineFont :public OpenGLFont {
private:
GLYPHMETRICSFLOAT gmf[CHAR_COUNT];
public:
OpenGLOutlineFont(ClientDC* dc, Font* font, FLOAT deviation = 0.0f, FLOAT extrusion = 0.1f)
:OpenGLFont(font)
{
if (dc == NULL || font == NULL) {
throw IException("Invalid argument");
}
HGDIOBJ prevFont = dc -> select(font);
//See https://msdn.microsoft.com/en-us/library/windows/desktop/dd374393(v=vs.85).aspx
BOOL rc = wglUseFontOutlines(dc -> get(), 0, getCharCount(), getListsBase(),
deviation, extrusion, WGL_FONT_POLYGONS, gmf);
dc -> select(prevFont);
if (rc == FALSE) {
throw IException("Failed to wglUseFontOutlines: Error(%s)", errorString());
}
}
};
}
Last modified: 10 Feb 2017
Copyright (c) 2009-2017 Antillia.com ALL RIGHTS RESERVED.