qfont.sip 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. // qfont.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtGui Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QFont
  22. {
  23. %TypeHeaderCode
  24. #include <qfont.h>
  25. %End
  26. public:
  27. enum StyleHint
  28. {
  29. Helvetica,
  30. SansSerif,
  31. Times,
  32. Serif,
  33. Courier,
  34. TypeWriter,
  35. OldEnglish,
  36. Decorative,
  37. System,
  38. AnyStyle,
  39. Cursive,
  40. Monospace,
  41. Fantasy,
  42. };
  43. enum StyleStrategy /BaseType=Flag/
  44. {
  45. PreferDefault,
  46. PreferBitmap,
  47. PreferDevice,
  48. PreferOutline,
  49. ForceOutline,
  50. PreferMatch,
  51. PreferQuality,
  52. PreferAntialias,
  53. NoAntialias,
  54. NoSubpixelAntialias,
  55. NoFontMerging,
  56. PreferNoShaping,
  57. %If (Qt_6_8_0 -)
  58. ContextFontMerging,
  59. %End
  60. %If (Qt_6_8_0 -)
  61. PreferTypoLineMetrics,
  62. %End
  63. };
  64. enum Weight /BaseType=IntEnum/
  65. {
  66. Thin,
  67. ExtraLight,
  68. Light,
  69. Normal,
  70. Medium,
  71. DemiBold,
  72. Bold,
  73. ExtraBold,
  74. Black,
  75. };
  76. enum Style
  77. {
  78. StyleNormal,
  79. StyleItalic,
  80. StyleOblique,
  81. };
  82. enum Stretch /BaseType=IntEnum/
  83. {
  84. AnyStretch,
  85. UltraCondensed,
  86. ExtraCondensed,
  87. Condensed,
  88. SemiCondensed,
  89. Unstretched,
  90. SemiExpanded,
  91. Expanded,
  92. ExtraExpanded,
  93. UltraExpanded,
  94. };
  95. QFont();
  96. %If (Qt_6_1_0 -)
  97. QFont(const QStringList &families, int pointSize = -1, int weight = -1, bool italic = false);
  98. %End
  99. QFont(const QString &family, int pointSize = -1, int weight = -1, bool italic = false);
  100. QFont(const QFont &);
  101. QFont(const QVariant &variant /GetWrapper/) /NoDerived/;
  102. %MethodCode
  103. if (a0->canConvert<QFont>())
  104. sipCpp = new QFont(a0->value<QFont>());
  105. else
  106. sipError = sipBadCallableArg(0, a0Wrapper);
  107. %End
  108. ~QFont();
  109. QString family() const;
  110. void setFamily(const QString &);
  111. int pointSize() const;
  112. void setPointSize(int);
  113. qreal pointSizeF() const;
  114. void setPointSizeF(qreal);
  115. int pixelSize() const;
  116. void setPixelSize(int);
  117. int weight() const [QFont::Weight ()];
  118. void setWeight(int weight);
  119. %MethodCode
  120. sipCpp->setWeight(QFont::Weight(a0));
  121. %End
  122. void setStyle(QFont::Style style);
  123. QFont::Style style() const;
  124. bool underline() const;
  125. void setUnderline(bool);
  126. bool overline() const;
  127. void setOverline(bool);
  128. bool strikeOut() const;
  129. void setStrikeOut(bool);
  130. bool fixedPitch() const;
  131. void setFixedPitch(bool);
  132. bool kerning() const;
  133. void setKerning(bool);
  134. QFont::StyleHint styleHint() const;
  135. QFont::StyleStrategy styleStrategy() const;
  136. void setStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault);
  137. void setStyleStrategy(QFont::StyleStrategy s);
  138. int stretch() const;
  139. void setStretch(int);
  140. bool exactMatch() const;
  141. bool operator==(const QFont &) const;
  142. bool operator!=(const QFont &) const;
  143. bool operator<(const QFont &) const;
  144. bool isCopyOf(const QFont &) const;
  145. QString key() const;
  146. QString toString() const;
  147. bool fromString(const QString &);
  148. static QString substitute(const QString &);
  149. static QStringList substitutes(const QString &);
  150. static QStringList substitutions();
  151. static void insertSubstitution(const QString &, const QString &);
  152. static void insertSubstitutions(const QString &, const QStringList &);
  153. static void removeSubstitutions(const QString &);
  154. static void initialize();
  155. static void cleanup();
  156. static void cacheStatistics();
  157. QString defaultFamily() const;
  158. QFont resolve(const QFont &) const;
  159. bool bold() const;
  160. void setBold(bool enable);
  161. bool italic() const;
  162. void setItalic(bool b);
  163. enum Capitalization
  164. {
  165. MixedCase,
  166. AllUppercase,
  167. AllLowercase,
  168. SmallCaps,
  169. Capitalize,
  170. };
  171. enum SpacingType
  172. {
  173. PercentageSpacing,
  174. AbsoluteSpacing,
  175. };
  176. qreal letterSpacing() const;
  177. QFont::SpacingType letterSpacingType() const;
  178. void setLetterSpacing(QFont::SpacingType type, qreal spacing);
  179. qreal wordSpacing() const;
  180. void setWordSpacing(qreal spacing);
  181. void setCapitalization(QFont::Capitalization);
  182. QFont::Capitalization capitalization() const;
  183. enum HintingPreference
  184. {
  185. PreferDefaultHinting,
  186. PreferNoHinting,
  187. PreferVerticalHinting,
  188. PreferFullHinting,
  189. };
  190. QString styleName() const;
  191. void setStyleName(const QString &styleName);
  192. void setHintingPreference(QFont::HintingPreference hintingPreference);
  193. QFont::HintingPreference hintingPreference() const;
  194. void swap(QFont &other /Constrained/);
  195. Py_hash_t __hash__() const;
  196. %MethodCode
  197. sipRes = qHash(*sipCpp);
  198. %End
  199. QStringList families() const;
  200. void setFamilies(const QStringList &);
  201. %If (Qt_6_7_0 -)
  202. void setFeature(QFont::Tag tag, quint32 value);
  203. %End
  204. %If (Qt_6_6_0 - Qt_6_7_0)
  205. void setFeature(quint32 tag, quint32 value);
  206. %End
  207. %If (Qt_6_6_0 - Qt_6_7_0)
  208. void setFeature(const char *feature /Encoding="None"/, quint32 value);
  209. %End
  210. %If (Qt_6_7_0 -)
  211. void unsetFeature(QFont::Tag tag);
  212. %End
  213. %If (Qt_6_6_0 - Qt_6_7_0)
  214. void unsetFeature(const char *feature /Encoding="None"/);
  215. %End
  216. %If (Qt_6_6_0 - Qt_6_7_0)
  217. void unsetFeature(quint32 tag);
  218. %End
  219. %If (Qt_6_7_0 -)
  220. quint32 featureValue(QFont::Tag tag) const;
  221. %End
  222. %If (Qt_6_6_0 - Qt_6_7_0)
  223. quint32 featureValue(quint32 tag) const;
  224. %End
  225. %If (Qt_6_7_0 -)
  226. bool isFeatureSet(QFont::Tag tag) const;
  227. %End
  228. %If (Qt_6_6_0 - Qt_6_7_0)
  229. bool isFeatureSet(quint32 tag) const;
  230. %End
  231. %If (Qt_6_7_0 -)
  232. QList<QFont::Tag> featureTags() const;
  233. %End
  234. %If (Qt_6_6_0 - Qt_6_7_0)
  235. QList<unsigned int> featureTags() const;
  236. %End
  237. %If (Qt_6_6_0 -)
  238. void clearFeatures();
  239. %End
  240. %If (Qt_6_6_0 - Qt_6_7_0)
  241. static QByteArray tagToString(quint32 tag);
  242. %End
  243. %If (Qt_6_6_0 - Qt_6_7_0)
  244. static quint32 stringToTag(const char *tagString /Encoding="None"/);
  245. %End
  246. %If (Qt_6_7_0 -)
  247. struct Tag
  248. {
  249. %TypeHeaderCode
  250. #include <qfont.h>
  251. %End
  252. Tag();
  253. Tag(QAnyStringView view);
  254. %MethodCode
  255. // This is the easiest way to implement this ctor.
  256. std::optional<::QFont::Tag> opt_tag = ::QFont::Tag::fromString(*a0);
  257. if (opt_tag.has_value())
  258. sipCpp = new ::QFont::Tag(opt_tag.value());
  259. else
  260. sipCpp = new ::QFont::Tag;
  261. %End
  262. bool isValid() const;
  263. quint32 value() const;
  264. QByteArray toString() const;
  265. static std::optional<QFont::Tag> fromValue(quint32 value);
  266. static std::optional<QFont::Tag> fromString(QAnyStringView view);
  267. Py_hash_t __hash__() const;
  268. %MethodCode
  269. sipRes = qHash(*sipCpp);
  270. %End
  271. };
  272. %End
  273. %If (Qt_6_7_0 -)
  274. void setVariableAxis(QFont::Tag tag, float value);
  275. %End
  276. %If (Qt_6_7_0 -)
  277. void unsetVariableAxis(QFont::Tag tag);
  278. %End
  279. %If (Qt_6_7_0 -)
  280. bool isVariableAxisSet(QFont::Tag tag) const;
  281. %End
  282. %If (Qt_6_7_0 -)
  283. float variableAxisValue(QFont::Tag tag) const;
  284. %End
  285. %If (Qt_6_7_0 -)
  286. void clearVariableAxes();
  287. %End
  288. %If (Qt_6_7_0 -)
  289. QList<QFont::Tag> variableAxisTags() const;
  290. %End
  291. };
  292. QDataStream &operator<<(QDataStream &, const QFont &) /ReleaseGIL/;
  293. QDataStream &operator>>(QDataStream &, QFont & /Constrained/) /ReleaseGIL/;
  294. %If (Qt_6_7_0 -)
  295. QDataStream &operator<<(QDataStream &, QFont::Tag) /ReleaseGIL/;
  296. %End
  297. %If (Qt_6_7_0 -)
  298. QDataStream &operator>>(QDataStream &, QFont::Tag & /Constrained/) /ReleaseGIL/;
  299. %End
  300. %If (Qt_6_7_0 -)
  301. bool operator>=(const QFont::Tag &lhs, const QFont::Tag &rhs);
  302. %End
  303. %If (Qt_6_7_0 -)
  304. bool operator<=(const QFont::Tag &lhs, const QFont::Tag &rhs);
  305. %End
  306. %If (Qt_6_7_0 -)
  307. bool operator>(const QFont::Tag &lhs, const QFont::Tag &rhs);
  308. %End
  309. %If (Qt_6_7_0 -)
  310. bool operator<(const QFont::Tag &lhs, const QFont::Tag &rhs);
  311. %End
  312. %If (Qt_6_7_0 -)
  313. bool operator!=(const QFont::Tag &lhs, const QFont::Tag &rhs);
  314. %End
  315. %If (Qt_6_7_0 -)
  316. bool operator==(const QFont::Tag &lhs, const QFont::Tag &rhs);
  317. %End