Blame cairomm/fontoptions.h

Packit 908522
/* Copyright (C) 2005 The cairomm Development Team
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
#ifndef __CAIROMM_FONTOPTIONS_H
Packit 908522
#define __CAIROMM_FONTOPTIONS_H
Packit 908522
Packit 908522
#include <cairomm/enums.h>
Packit 908522
#include <string>
Packit 908522
//#include <cairo.h>
Packit 908522
#ifdef CAIRO_HAS_FT_FONT
Packit 908522
#include <cairo-ft.h>
Packit 908522
#endif // CAIRO_HAS_FT_FONT
Packit 908522
Packit 908522
namespace Cairo
Packit 908522
{
Packit 908522
Packit 908522
/**
Packit 908522
 * The font options specify how fonts should be rendered.  Most of the
Packit 908522
 * time the font options implied by a surface are just right and do not
Packit 908522
 * need any changes, but for pixel-based targets tweaking font options
Packit 908522
 * may result in superior output on a particular display.
Packit 908522
 */
Packit 908522
class FontOptions
Packit 908522
{
Packit 908522
public:
Packit 908522
  FontOptions();
Packit 908522
  explicit FontOptions(cairo_font_options_t* cobject, bool take_ownership = false);
Packit 908522
  FontOptions(const FontOptions& src);
Packit 908522
Packit 908522
  virtual ~FontOptions();
Packit 908522
Packit 908522
  FontOptions& operator=(const FontOptions& src);
Packit 908522
Packit 908522
  bool operator ==(const FontOptions& src) const;
Packit 908522
  //bool operator !=(const FontOptions& src) const;
Packit 908522
Packit 908522
  /**
Packit 908522
   * Merges non-default options from @a other into this, replacing existing
Packit 908522
   * values. This operation can be thought of as somewhat similar to compositing
Packit 908522
   * @a other onto this with the operation of OPERATION_OVER.
Packit 908522
   *
Packit 908522
   * @param other another FontOptions
Packit 908522
   **/
Packit 908522
  void merge(const FontOptions& other);
Packit 908522
Packit 908522
  /**
Packit 908522
   * Compute a hash for the font options object; this value will be useful when
Packit 908522
   * storing an object containing a FontOptions in a hash table.
Packit 908522
   *
Packit 908522
   * @return the hash value for the font options object.  The return value can
Packit 908522
   * be cast to a 32-bit type if a 32-bit hash value is needed.
Packit 908522
   **/
Packit 908522
  unsigned long hash() const;
Packit 908522
Packit 908522
  /**
Packit 908522
   * Sets the antialiasing mode for the font options object. This
Packit 908522
   * specifies the type of antialiasing to do when rendering text.
Packit 908522
   *
Packit 908522
   * @param antialias the new antialiasing mode.
Packit 908522
   **/
Packit 908522
  void set_antialias(Antialias antialias);
Packit 908522
Packit 908522
  /**
Packit 908522
   * Gets the antialiasing mode for the font options object.
Packit 908522
   *
Packit 908522
   * @return the antialiasing mode
Packit 908522
   **/
Packit 908522
  Antialias get_antialias() const;
Packit 908522
Packit 908522
  /**
Packit 908522
   * Sets the subpixel order for the font options object. The subpixel order
Packit 908522
   * specifies the order of color elements within each pixel on the display
Packit 908522
   * device when rendering with an antialiasing mode of
Packit 908522
   * Cairo::ANTIALIAS_SUBPIXEL. See the documentation for SubpixelOrder for
Packit 908522
   * full details.
Packit 908522
   *
Packit 908522
   * @param subpixel_order the new subpixel order.
Packit 908522
   **/
Packit 908522
  void set_subpixel_order(SubpixelOrder subpixel_order);
Packit 908522
Packit 908522
  /**
Packit 908522
   * Gets the subpixel order for the font options object.  See the documentation
Packit 908522
   * for SubpixelOrder for full details.
Packit 908522
   *
Packit 908522
   * @return the subpixel order for the font options object.
Packit 908522
   **/
Packit 908522
  SubpixelOrder get_subpixel_order() const;
Packit 908522
Packit 908522
  /**
Packit 908522
   * Sets the hint style for font outlines for the font options object.  This
Packit 908522
   * controls whether to fit font outlines to the pixel grid, and if so, whether
Packit 908522
   * to optimize for fidelity or contrast.  See the documentation for
Packit 908522
   * HintStyle for full details.
Packit 908522
   *
Packit 908522
   * @param hint_style the new hint style.
Packit 908522
   **/
Packit 908522
  void set_hint_style(HintStyle hint_style);
Packit 908522
Packit 908522
  /**
Packit 908522
   * Gets the hint style for font outlines for the font options object.
Packit 908522
   * See the documentation for HintStyle for full details.
Packit 908522
   *
Packit 908522
   * @return the hint style for the font options object.
Packit 908522
   **/
Packit 908522
  HintStyle get_hint_style() const;
Packit 908522
Packit 908522
  /**
Packit 908522
   * Sets the metrics hinting mode for the font options object. This
Packit 908522
   * controls whether metrics are quantized to integer values in
Packit 908522
   * device units.
Packit 908522
   * See the documentation for HintMetrics for full details.
Packit 908522
   *
Packit 908522
   * @param hint_metrics the new metrics hinting mode.
Packit 908522
   **/
Packit 908522
  void set_hint_metrics(HintMetrics hint_metrics);
Packit 908522
Packit 908522
  /**
Packit 908522
   * Gets the metrics hinting mode for the font options object.  See the
Packit 908522
   * documentation for HintMetrics for full details.
Packit 908522
   *
Packit 908522
   * Return value: the metrics hinting mode for the font options object.
Packit 908522
   **/
Packit 908522
  HintMetrics get_hint_metrics() const;
Packit 908522
Packit 908522
#ifdef CAIRO_HAS_FT_FONT
Packit 908522
#ifdef CAIRO_HAS_FC_FONT
Packit 908522
  /** Add options to a FcPattern based on a cairo_font_options_t font options
Packit 908522
   * object. Options that are already in the pattern, are not overridden, so you
Packit 908522
   * should call this function after calling FcConfigSubstitute() (the user's
Packit 908522
   * settings should override options based on the surface type), but before
Packit 908522
   * calling FcDefaultSubstitute().
Packit 908522
   *
Packit 908522
   * @param pattern an existing FcPattern.
Packit 908522
   *
Packit 908522
   * @since 1.8
Packit 908522
   */
Packit 908522
  void substitute(FcPattern* pattern);
Packit 908522
#endif // CAIRO_HAS_FC_FONT
Packit 908522
#endif // CAIRO_HAS_FT_FONT
Packit 908522
Packit 908522
  typedef cairo_font_options_t cobject;
Packit 908522
  inline cobject* cobj() { return m_cobject; }
Packit 908522
  inline const cobject* cobj() const { return m_cobject; }
Packit 908522
Packit 908522
  #ifndef DOXYGEN_IGNORE_THIS
Packit 908522
  ///For use only by the cairomm implementation.
Packit 908522
  inline ErrorStatus get_status() const
Packit 908522
  { return cairo_font_options_status(const_cast<cairo_font_options_t*>(cobj())); }
Packit 908522
  #endif //DOXYGEN_IGNORE_THIS
Packit 908522
Packit 908522
protected:
Packit 908522
Packit 908522
  cobject* m_cobject;
Packit 908522
};
Packit 908522
Packit 908522
} // namespace Cairo
Packit 908522
Packit 908522
#endif //__CAIROMM_FONTOPTIONS_H
Packit 908522
Packit 908522
// vim: ts=2 sw=2 et