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 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.FontEnumerator:
==========================================================================================================================================
|phoenix_title| **wx.FontEnumerator**
==========================================================================================================================================
:ref:`wx.FontEnumerator` enumerates either all available fonts on the system or only the ones with given attributes - either only fixed-width (suited for use in programs such as terminal emulators and the like) or the fonts available in the given encoding).
To do this, you just have to call one of EnumerateXXX() functions - either :meth:`wx.FontEnumerator.EnumerateFacenames` or :meth:`wx.FontEnumerator.EnumerateEncodings` and the corresponding callback (:meth:`wx.FontEnumerator.OnFacename` or :meth:`wx.FontEnumerator.OnFontEncoding` ) will be called repeatedly until either all fonts satisfying the specified criteria are exhausted or the callback returns ``False``.
|phoenix_title| Virtual functions to override
=============================================
Either OnFacename or OnFontEncoding should be overridden depending on whether you plan to call EnumerateFacenames or EnumerateEncodings. Of course, if you call both of them, you should override both functions.
.. seealso:: :ref:`Font Encodings <font encodings>`, :ref:`Font Sample <font sample>`, :ref:`wx.Font`, :ref:`wx.FontMapper`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>FontEnumerator</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.FontEnumerator_inheritance.png" alt="Inheritance diagram of FontEnumerator" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.FontEnumerator.html" title="wx.FontEnumerator" alt="" coords="5,5,152,35"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.FontEnumerator.__init__`
:meth:`~wx.FontEnumerator.EnumerateEncodings` Call :meth:`~FontEnumerator.OnFontEncoding` for each encoding supported by the given font - or for each encoding supported by at least some font if `font` is not specified.
:meth:`~wx.FontEnumerator.EnumerateFacenames` Call :meth:`~FontEnumerator.OnFacename` for each font which supports given encoding (only if it is not ``FONTENCODING_SYSTEM`` ) and is of fixed width (if `fixedWidthOnly` is ``True``).
:meth:`~wx.FontEnumerator.GetEncodings` Return array of strings containing all encodings found by :meth:`~FontEnumerator.EnumerateEncodings` .
:meth:`~wx.FontEnumerator.GetFacenames` Return array of strings containing all facenames found by :meth:`~FontEnumerator.EnumerateFacenames` .
:meth:`~wx.FontEnumerator.IsValidFacename` Returns ``True`` if the given string is valid face name, i.e.
:meth:`~wx.FontEnumerator.OnFacename` Called by :meth:`~FontEnumerator.EnumerateFacenames` for each match.
:meth:`~wx.FontEnumerator.OnFontEncoding` Called by :meth:`~FontEnumerator.EnumerateEncodings` for each match.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.FontEnumerator(object)
**Possible constructors**::
FontEnumerator()
FontEnumerator enumerates either all available fonts on the system
or only the ones with given attributes - either only fixed-width
(suited for use in programs such as terminal emulators and the like)
or the fonts available in the given encoding).
.. method:: __init__(self)
.. method:: EnumerateEncodings(self, font=EmptyString)
Call :meth:`OnFontEncoding` for each encoding supported by the given font - or for each encoding supported by at least some font if `font` is not specified.
:param `font`:
:type `font`: string
:rtype: `bool`
.. method:: EnumerateFacenames(self, encoding=FONTENCODING_SYSTEM, fixedWidthOnly=False)
Call :meth:`OnFacename` for each font which supports given encoding (only if it is not ``FONTENCODING_SYSTEM`` ) and is of fixed width (if `fixedWidthOnly` is ``True``).
Calling this function with default arguments will result in enumerating all fonts available on the system.
:param `encoding`:
:type `encoding`: wx.FontEncoding
:param `fixedWidthOnly`:
:type `fixedWidthOnly`: bool
:rtype: `bool`
.. staticmethod:: GetEncodings(facename=EmptyString)
Return array of strings containing all encodings found by :meth:`EnumerateEncodings` .
:param `facename`:
:type `facename`: string
:rtype: `list of strings`
.. staticmethod:: GetFacenames(encoding=FONTENCODING_SYSTEM, fixedWidthOnly=False)
Return array of strings containing all facenames found by :meth:`EnumerateFacenames` .
:param `encoding`:
:type `encoding`: wx.FontEncoding
:param `fixedWidthOnly`:
:type `fixedWidthOnly`: bool
:rtype: `list of strings`
.. staticmethod:: IsValidFacename(facename)
Returns ``True`` if the given string is valid face name, i.e.
it's the face name of an installed font and it can safely be used with :meth:`wx.Font.SetFaceName` .
:param `facename`:
:type `facename`: string
:rtype: `bool`
.. method:: OnFacename(self, font)
Called by :meth:`EnumerateFacenames` for each match.
Return ``True`` to continue enumeration or ``False`` to stop it.
:param `font`:
:type `font`: string
:rtype: `bool`
.. method:: OnFontEncoding(self, font, encoding)
Called by :meth:`EnumerateEncodings` for each match.
Return ``True`` to continue enumeration or ``False`` to stop it.
:param `font`:
:type `font`: string
:param `encoding`:
:type `encoding`: string
:rtype: `bool`
|