/usr/include/Wt/WFont is in libwt-dev 3.3.4+dfsg-6ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WFONT_H_
#define WFONT_H_
#include <Wt/WLength>
#include <Wt/WString>
namespace Wt {
class DomElement;
class WWebWidget;
/*! \class WFont Wt/WFont Wt/WFont
* \brief A value class that describes a font.
*
* \ingroup style painting
*/
class WT_API WFont
{
public:
/*! \brief The generic font family.
*/
enum GenericFamily { Default, //!< Browser-dependent default
Serif, //!< for example: Times
SansSerif, //!< for example: Helvetica
Cursive, //!< for example: Zapf-Chancery
Fantasy, //!< for example: Western
Monospace //!< for example: Courier
};
/*! \brief The font style.
*/
enum Style { NormalStyle, //!< Normal (default)
Italic, //!< Italic
Oblique //!< Oblique
};
/*! \brief The font variant.
*/
enum Variant { NormalVariant, //!< Normal (default)
SmallCaps //!< Small Capitals
};
/*! \brief The font weight.
*/
enum Weight { NormalWeight, //!< Normal (default) (Value == 400)
Bold, //!< Bold (Value == 700)
Bolder, //!< Bolder than the parent widget
Lighter, //!< Lighter than the parent widget
Value //!< Specify a value (100 - 900)
};
/*! \brief The font size.
*/
enum Size { XXSmall, //!< Extra Extra small
XSmall, //!< Extra small
Small, //!< Small
Medium, //!< Medium, default
Large, //!< Large
XLarge, //!< Extra large
XXLarge, //!< Extra Extra large
Smaller, //!< Relatively smaller than the parent widget
Larger, //!< Relatively larger than the parent widget
FixedSize //!< Explicit size, See also fontFixedSize()
};
/*! \brief A default font (dependent on the user agent).
*/
WFont();
/*! \brief A font of a given family.
*
* Creates a Medium font of the given family.
*/
WFont(GenericFamily family);
/*! \brief Comparison operator.
*/
bool operator==(const WFont& other) const;
bool operator!=(const WFont& other) const;
/*! \brief Sets the font family.
*
* The font family is specified using a generic family name,
* in addition to a comma-seperated list of specific font choices.
*
* The first specific font that can be matched will be used, otherwise
* a generic font will be used.
*
* Careful, for a font family name that contains a space, you need
* to add quotes, to WFont::setFamily(), e.g.
*
* \code
* WFont mono;
* mono.setFamily(WFont::Monospace, "'Courier New'");
* mono.setSize(18);
* \endcode
*/
void setFamily(GenericFamily genericFamily,
const WString& specificFamilies = WString());
/*! \brief Returns the font generic family.
*/
GenericFamily genericFamily() const { return genericFamily_; }
/*! \brief Returns the font specific family names.
*/
const WString& specificFamilies() const { return specificFamilies_; }
/*! \brief Sets the font style.
*/
void setStyle(Style style);
/*! \brief Returns the font style.
*/
Style style() const { return style_; }
/*! \brief Sets the font variant.
*/
void setVariant(Variant variant);
/*! \brief Returns the font variant.
*/
Variant variant() const { return variant_; }
/*! \brief Sets the font weight.
*
* When setting weight == Value, you may specify a value.
*
* Valid values are between 100 and 900, and are rounded to multiples of
* 100.
*/
void setWeight(Weight weight, int value = 400);
/*! \brief Returns the font weight.
*/
Weight weight() const;
/*! \brief Returns the font weight value.
*/
int weightValue() const;
/*! \brief Sets the font size (<b>deprecated</b>)
*
* Use setSize(Size) or setSize(const WLength&) instead.
*/
void setSize(Size size, const WLength& length);
/*! \brief Sets the font size.
*
* Sets the font size using a predefined CSS size.
*/
void setSize(Size size);
/*! \brief Sets the font size.
*
* Sets the font size.
*/
void setSize(const WLength& size);
/*! \brief Returns the font size.
*/
Size size(double mediumSize = 16) const;
/*! \brief Returns the font size as a numerical value (<b>deprecated</b>).
*
* \deprecated This method has been renamed to sizeLength()
*/
WLength fixedSize() const;
/*! \brief Returns the font size as a numerical value.
*
* Absolute size enumerations are converted to a length assuming a
* Medium font size of 16 px.
*/
WLength sizeLength(double mediumSize = 16) const;
const std::string cssText(bool combined = true) const;
void updateDomElement(DomElement& element, bool fontall, bool all);
private:
WWebWidget *widget_;
GenericFamily genericFamily_;
WString specificFamilies_;
Style style_;
Variant variant_;
Weight weight_;
int weightValue_;
Size size_;
WLength sizeLength_;
bool familyChanged_;
bool styleChanged_;
bool variantChanged_;
bool weightChanged_;
bool sizeChanged_;
std::string cssStyle(bool all) const;
std::string cssVariant(bool all) const;
std::string cssWeight(bool all) const;
std::string cssFamily(bool all) const;
std::string cssSize(bool all) const;
void setWebWidget(WWebWidget *w);
friend class WCssDecorationStyle;
};
}
#endif // WFONT_H_
|