|
Packit Service |
e3b512 |
/* Copyright (C) 2005 The cairomm Development Team
|
|
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/fontoptions.h>
|
|
Packit Service |
e3b512 |
#include <cairomm/private.h>
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
namespace Cairo
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
FontOptions::FontOptions()
|
|
Packit Service |
e3b512 |
: m_cobject(nullptr)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
m_cobject = cairo_font_options_create();
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
FontOptions::FontOptions(cairo_font_options_t* cobject, bool take_ownership)
|
|
Packit Service |
e3b512 |
: m_cobject(nullptr)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
if(take_ownership)
|
|
Packit Service |
e3b512 |
m_cobject = cobject;
|
|
Packit Service |
e3b512 |
else
|
|
Packit Service |
e3b512 |
m_cobject = cairo_font_options_copy(cobject);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
FontOptions::FontOptions(const FontOptions& src)
|
|
Packit Service |
e3b512 |
: m_cobject(nullptr)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
//Reference-counting, instead of copying by value:
|
|
Packit Service |
e3b512 |
if(!src.m_cobject)
|
|
Packit Service |
e3b512 |
m_cobject = nullptr;
|
|
Packit Service |
e3b512 |
else
|
|
Packit Service |
e3b512 |
m_cobject = cairo_font_options_copy(src.m_cobject);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
FontOptions::~FontOptions()
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
if(m_cobject)
|
|
Packit Service |
e3b512 |
cairo_font_options_destroy(m_cobject);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
FontOptions& FontOptions::operator=(const FontOptions& src)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
//Reference-counting, instead of copying by value:
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
if(this == &src)
|
|
Packit Service |
e3b512 |
return *this;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
if(m_cobject == src.m_cobject)
|
|
Packit Service |
e3b512 |
return *this;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
if(m_cobject)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_font_options_destroy(m_cobject);
|
|
Packit Service |
e3b512 |
m_cobject = nullptr;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
if(!src.m_cobject)
|
|
Packit Service |
e3b512 |
return *this;
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
m_cobject = cairo_font_options_copy(src.m_cobject);
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
return *this;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
bool FontOptions::operator==(const FontOptions& src) const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
return cairo_font_options_equal(m_cobject, src.cobj());
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void FontOptions::merge(const FontOptions& src)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_font_options_merge(m_cobject, src.cobj());
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
unsigned long FontOptions::hash() const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
const auto result = cairo_font_options_hash(m_cobject);
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
return result;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void FontOptions::set_antialias(Antialias antialias)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_font_options_set_antialias(m_cobject, static_cast<cairo_antialias_t>(antialias));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
Antialias FontOptions::get_antialias() const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
const auto result = static_cast<Antialias>(cairo_font_options_get_antialias(m_cobject));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
return result;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void FontOptions::set_subpixel_order(SubpixelOrder subpixel_order)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_font_options_set_subpixel_order(m_cobject, static_cast<cairo_subpixel_order_t>(subpixel_order));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
SubpixelOrder FontOptions::get_subpixel_order() const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
const auto result = static_cast<SubpixelOrder>(cairo_font_options_get_subpixel_order(m_cobject));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
return result;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void FontOptions::set_hint_style(HintStyle hint_style)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_font_options_set_hint_style(m_cobject, static_cast<cairo_hint_style_t>(hint_style));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
HintStyle FontOptions::get_hint_style() const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
const auto result = static_cast<HintStyle>(cairo_font_options_get_hint_style(m_cobject));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
return result;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
void FontOptions::set_hint_metrics(HintMetrics hint_metrics)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_font_options_set_hint_metrics(m_cobject,
|
|
Packit Service |
e3b512 |
static_cast<cairo_hint_metrics_t>(hint_metrics));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
HintMetrics FontOptions::get_hint_metrics() const
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
const auto result =
|
|
Packit Service |
e3b512 |
static_cast<HintMetrics>(cairo_font_options_get_hint_metrics(m_cobject));
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
return result;
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
#ifdef CAIRO_HAS_FT_FONT
|
|
Packit Service |
e3b512 |
#ifdef CAIRO_HAS_FC_FONT
|
|
Packit Service |
e3b512 |
void FontOptions::substitute(FcPattern* pattern)
|
|
Packit Service |
e3b512 |
{
|
|
Packit Service |
e3b512 |
cairo_ft_font_options_substitute(cobj(), pattern);
|
|
Packit Service |
e3b512 |
check_object_status_and_throw_exception(*this);
|
|
Packit Service |
e3b512 |
}
|
|
Packit Service |
e3b512 |
#endif // CAIRO_HAS_FC_FONT
|
|
Packit Service |
e3b512 |
#endif // CAIRO_HAS_FT_FONT
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
} //namespace Cairo
|
|
Packit Service |
e3b512 |
|
|
Packit Service |
e3b512 |
// vim: ts=2 sw=2 et
|