|
Packit Service |
e3b512 |
/* Copyright (C) 2008 Jonathon Jongsma
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
e3b512 |
* modify it under the terms of the GNU Library General Public
|
|
Packit Service |
e3b512 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
e3b512 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
e3b512 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
e3b512 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
e3b512 |
* Library General Public License for more details.
|
|
Packit Service |
e3b512 |
*
|
|
Packit Service |
e3b512 |
* You should have received a copy of the GNU Library General Public
|
|
Packit Service |
e3b512 |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
e3b512 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
e3b512 |
* 02110-1301, USA.
|
|
Packit Service |
e3b512 |
*/
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#include <cairomm/win32_font.h>
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#ifdef CAIRO_HAS_WIN32_FONT
|
|
Packit Service |
e3b512 |
#include <cairomm/private.h>
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
namespace Cairo {
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
Win32FontFace::Win32FontFace(LOGFONTW* logfont) :
|
|
Packit Service |
e3b512 |
FontFace(cairo_win32_font_face_create_for_logfontw(logfont), true)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
Win32FontFace::Win32FontFace(HFONT font) :
|
|
Packit Service |
e3b512 |
FontFace(cairo_win32_font_face_create_for_hfont(font), true)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
Win32FontFace::Win32FontFace(LOGFONTW* logfont, HFONT font) :
|
|
Packit Service |
e3b512 |
FontFace(cairo_win32_font_face_create_for_logfontw_hfont(logfont, font), true)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
RefPtr<Win32FontFace> Win32FontFace::create(LOGFONTW* logfont)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
return RefPtr<Win32FontFace>(new Win32FontFace(logfont));
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
RefPtr<Win32FontFace> Win32FontFace::create(HFONT font)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
return RefPtr<Win32FontFace>(new Win32FontFace(font));
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
RefPtr<Win32FontFace> Win32FontFace::create(LOGFONTW* logfont, HFONT font)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
return RefPtr<Win32FontFace>(new Win32FontFace(logfont, font));
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
// ScaledFont
|
|
Packit Service |
e3b512 |
Win32ScaledFont::Win32ScaledFont(const RefPtr<Win32FontFace>& font_face,
|
|
Packit Service |
e3b512 |
const Matrix& font_matrix,
|
|
Packit Service |
e3b512 |
const Matrix& ctm,
|
|
Packit Service |
e3b512 |
const FontOptions& options) :
|
|
Packit Service |
e3b512 |
ScaledFont(font_face, font_matrix, ctm, options)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
RefPtr<Win32ScaledFont>
|
|
Packit Service |
e3b512 |
Win32ScaledFont::create(const RefPtr<Win32FontFace>& font_face,
|
|
Packit Service |
e3b512 |
const Matrix& font_matrix, const Matrix& ctm,
|
|
Packit Service |
e3b512 |
const FontOptions& options)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
return RefPtr<Win32ScaledFont>(new Win32ScaledFont(font_face, font_matrix,
|
|
Packit Service |
e3b512 |
ctm, options));
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void Win32ScaledFont::select_font(HDC hdc)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
auto status = cairo_win32_scaled_font_select_font(cobj(), hdc);
|
|
Packit Service |
e3b512 |
check_status_and_throw_exception(status);
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void Win32ScaledFont::done_font()
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_win32_scaled_font_done_font(cobj());
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
double Win32ScaledFont::get_metrics_factor() const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
auto val = cairo_win32_scaled_font_get_metrics_factor(const_cast<cairo_scaled_font_t*>(cobj()));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
return val;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void Win32ScaledFont::get_logical_to_device(Matrix& logical_to_device) const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_win32_scaled_font_get_logical_to_device(const_cast<cairo_scaled_font_t*>(cobj()),
|
|
Packit Service |
e3b512 |
static_cast<cairo_matrix_t*>(&logical_to_device));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void Win32ScaledFont::get_device_to_logical(Matrix& device_to_logical) const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_win32_scaled_font_get_device_to_logical(const_cast<cairo_scaled_font_t*>(cobj()),
|
|
Packit Service |
e3b512 |
static_cast<cairo_matrix_t*>(&device_to_logical));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#endif // CAIRO_HAS_WIN32_FONT
|