Blame cairomm/win32_font.cc

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