Skip to content

Commit df6388b

Browse files
committed
Documentation: Round 2 of syntax updates.
1 parent 7b22b8b commit df6388b

14 files changed

Lines changed: 44 additions & 44 deletions

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Within `docs` update the associated restructured text (`.rst`) files. These file
1414

1515
### Conventions
1616

17-
- Code parameters should be referenced within backticks, not italics, double backtick is better for safety
18-
- When referencing names of common things surround with | , e.g. |PyMuPDF| , not PyMuPDF, see `header.rst` for names listing
17+
- Code parameters and referenced code objects should be referenced within backticks, not italics, double backtick is better for safety
18+
- When referencing names of some of our products surround with | , e.g. |PyMuPDF| , not PyMuPDF, see `header.rst` for products names listing
1919
- When hyperlinking, avoid inline hyperlinks and try to references link from common location at page bottom, also avoid the use of "here" or "click here" as this provides little information about the link content. e.g.
2020

2121
"`Click here <link>` for our Story class". Should be re-written to something more like "Find out more `on our Story class <link>`"

docs/font.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Font
88

99
* New in v1.16.18
1010

11-
This class represents a font as defined in MuPDF (*fz_font_s* structure). It is required for the new class :ref:`TextWriter` and the new :meth:`Page.write_text`. Currently, it has no connection to how fonts are used in methods :meth:`Page.insert_text` or :meth:`Page.insert_textbox`, respectively.
11+
This class represents a font as defined in |MuPDF| (``fz_font_s`` structure). It is required for the new class :ref:`TextWriter` and the new :meth:`Page.write_text`. Currently, it has no connection to how fonts are used in methods :meth:`Page.insert_text` or :meth:`Page.insert_textbox`, respectively.
1212

13-
A Font object also contains useful general information, like the font bbox, the number of defined glyphs, glyph names or the bbox of a single glyph.
13+
A ``Font`` object also contains useful general information, like the font bbox, the number of defined glyphs, glyph names or the ``bbox`` of a single glyph.
1414

1515

1616
==================================== ============================================
@@ -74,7 +74,7 @@ A Font object also contains useful general information, like the font bbox, the
7474
:arg bool is_italic: look for an italic font.
7575
:arg bool is_serif: look for a serifed font.
7676

77-
:returns: a MuPDF font if successful. This is the overall sequence of checks to determine an appropriate font:
77+
:returns: a |MuPDF| font if successful. This is the overall sequence of checks to determine an appropriate font:
7878

7979
=========== ============================================================
8080
Argument Action
@@ -138,9 +138,9 @@ A Font object also contains useful general information, like the font bbox, the
138138

139139
.. method:: has_glyph(chr, language=None, script=0, fallback=False)
140140

141-
Check whether the unicode *chr* exists in the font or (option) some fallback font. May be used to check whether any "TOFU" symbols will appear on output.
141+
Check whether the unicode ``chr`` exists in the font or (option) some fallback font. May be used to check whether any "TOFU" symbols will appear on output.
142142

143-
:arg int chr: the unicode of the character (i.e. *ord()*).
143+
:arg int chr: the unicode of the character (i.e. ``ord()``).
144144
:arg str language: the language -- currently unused.
145145
:arg int script: the UCDN script number.
146146
:arg bool fallback: *(new in v1.17.5)* perform an extended search in fallback fonts or restrict to current font (default).
@@ -152,7 +152,7 @@ A Font object also contains useful general information, like the font bbox, the
152152

153153
Return an array of unicodes supported by this font.
154154

155-
:returns: an *array.array* [#f2]_ of length at most :attr:`Font.glyph_count`. I.e. *chr()* of every item in this array has a glyph in the font without using fallbacks. This is an example display of the supported glyphs:
155+
:returns: an ``array.array`` [#f2]_ of length at most :attr:`Font.glyph_count`. I.e. ``chr()`` of every item in this array has a glyph in the font without using fallbacks. This is an example display of the supported glyphs:
156156

157157
>>> import pymupdf
158158
>>> font = pymupdf.Font("math")
@@ -191,8 +191,8 @@ A Font object also contains useful general information, like the font bbox, the
191191

192192
Calculate the "width" of the character's glyph (visual representation).
193193

194-
:arg int chr: the unicode number of the character. Use *ord()*, not the character itself. Again, this should normally work even if a character is not supported by that font, because fallback fonts will be checked where necessary.
195-
:arg int wmode: write mode, 0 = horizontal, 1 = vertical.
194+
:arg int chr: the unicode number of the character. Use ``ord()``, not the character itself. Again, this should normally work even if a character is not supported by that font, because fallback fonts will be checked where necessary.
195+
:arg int wmode: write mode, ``0`` = horizontal, ``1`` = vertical.
196196

197197
The other parameters are not in use currently.
198198

@@ -218,7 +218,7 @@ A Font object also contains useful general information, like the font bbox, the
218218

219219
The glyph rectangle relative to :data:`fontsize` 1.
220220

221-
:arg int chr: *ord()* of the character.
221+
:arg int chr: ``ord()`` of the character.
222222

223223
:returns: a :ref:`Rect`.
224224

@@ -227,7 +227,7 @@ A Font object also contains useful general information, like the font bbox, the
227227

228228
Show the name of the character's glyph.
229229

230-
:arg int ch: the unicode number of the character. Use *ord()*, not the character itself.
230+
:arg int ch: the unicode number of the character. Use ``ord()``, not the character itself.
231231

232232
:returns: a string representing the glyph's name. E.g. `font.glyph_name(ord("#")) = "numbersign"`. For an invalid code ".notfound" is returned.
233233

@@ -340,15 +340,15 @@ A Font object also contains useful general information, like the font bbox, the
340340

341341
* New in v1.18.0
342342

343-
The ascender value of the font, see `here <https://en.wikipedia.org/wiki/Ascender_(typography)>`_ for details. Please note that there is a difference to the strict definition: our value includes everything above the baseline -- not just the height difference between upper case "A" and and lower case "a".
343+
The ascender value of the font, see `ascender typography <https://en.wikipedia.org/wiki/Ascender_(typography)>`_ for details. Please note that there is a difference to the strict definition: our value includes everything above the baseline -- not just the height difference between upper case "A" and and lower case "a".
344344

345345
:rtype: float
346346

347347
.. attribute:: descender
348348

349349
* New in v1.18.0
350350

351-
The descender value of the font, see `here <https://en.wikipedia.org/wiki/Descender>`_ for details. This value always is negative and is the portion that some glyphs descend below the base line, for example "g" or "y". As a consequence, the value `ascender - descender` is the total height, that every glyph of the font fits into. This is true at least for most fonts -- as always, there are exceptions, especially for calligraphic fonts, etc.
351+
The descender value of the font, see `descender typography <https://en.wikipedia.org/wiki/Descender>`_ for details. This value always is negative and is the portion that some glyphs descend below the base line, for example "g" or "y". As a consequence, the value `ascender - descender` is the total height, that every glyph of the font fits into. This is true at least for most fonts -- as always, there are exceptions, especially for calligraphic fonts, etc.
352352

353353
:rtype: float
354354

docs/functions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ Yet others are handy, general-purpose utilities.
132132
Write to Python's `logging` system using specified level.
133133
:arg str pylogging_name:
134134
Write to Python's `logging` system using specified logger name.
135-
Only used if `pylogging_logger` is None. Default is `pymupdf`.
135+
Only used if `pylogging_logger` is ``None``. Default is `pymupdf`.
136136

137-
If any `pylogging*` arg is not None, we write to `Python's logging system
137+
If any `pylogging*` arg is not ``None``, we write to `Python's logging system
138138
<https://docs.python.org/3/library/logging.html>`_.
139139

140140
-----
@@ -172,7 +172,7 @@ Yet others are handy, general-purpose utilities.
172172
:arg str name: the name of some glyph. The function is based on the `Adobe Glyph List <https://github.com/adobe-type-tools/agl-aglfn/blob/master/glyphlist.txt>`_.
173173

174174
:rtype: int
175-
:returns: the unicode. Invalid *name* entries return `0xfffd (65533)`.
175+
:returns: the unicode. Invalid ``name`` entries return `0xfffd (65533)`.
176176

177177
.. note:: A similar functionality is provided by package `fontTools <https://pypi.org/project/fonttools/>`_ in its *agl* sub-package.
178178

@@ -412,7 +412,7 @@ Yet others are handy, general-purpose utilities.
412412
Calculate the length of text on output with a given **builtin** font, :data:`fontsize` and encoding.
413413

414414
:arg str text: the text string.
415-
:arg str fontname: the fontname. Must be one of either the :ref:`Base-14-Fonts` or the CJK fonts, identified by their "reserved" fontnames (see table in :meth:`Page.insert_font`).
415+
:arg str fontname: the font name. Must be one of either the :ref:`Base-14-Fonts` or the CJK fonts, identified by their "reserved" fontnames (see table in :meth:`Page.insert_font`).
416416
:arg float fontsize: the :data:`fontsize`.
417417
:arg int encoding: the encoding to use. Besides 0 = Latin, 1 = Greek and 2 = Cyrillic (Russian) are available. Relevant for Base-14 fonts "Helvetica", "Courier" and "Times" and their variants only. Make sure to use the same value as in the corresponding text insertion.
418418
:rtype: float

docs/how-to-open-a-file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ To open a file, do the following:
3232
doc = pymupdf.open("a.pdf")
3333
3434
35-
.. note:: The above creates a :ref:`Document`. The instruction `doc = pymupdf.Document("a.pdf")` does exactly the same. So, `open` is just a convenient alias and you can find its full API documented in that chapter.
35+
.. note:: The above creates a :ref:`Document`. The instruction `doc = pymupdf.Document("a.pdf")` does exactly the same. So, `open` is just a convenient alias and you can find its full API documented in that chapter.
3636

3737

3838
File Recognizer: Opening with :index:`a Wrong File Extension <pair: wrong; file extension>`

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ For example:
3030
Installation
3131
---------------------------------------------------------
3232

33-
PyMuPDF should be installed using pip with::
33+
|PyMuPDF| should be installed using pip with::
3434

3535
pip install --upgrade pymupdf
3636

docs/irect.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ IRect is a rectangular bounding box, very similar to :ref:`Rect`, except that al
7575
Checks whether *x* is contained in the rectangle. It may be :data:`rect_like`, :data:`point_like` or a number. If *x* is an empty rectangle, this is always true. Conversely, if the rectangle is empty this is always ``False``, if *x* is not an empty rectangle and not a number. If *x* is a number, it will be checked to be one of the four components. *x in irect* and *irect.contains(x)* are equivalent.
7676

7777
:arg x: the object to check.
78-
:type x: :ref:`IRect` or :ref:`Rect` or :ref:`Point` or int
78+
:type x: :ref:`IRect` or :ref:`Rect` or :ref:`Point` or `int`.
7979

8080
:rtype: bool
8181

docs/matrix.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Matrix
99
Matrix is a row-major 3x3 matrix used by image transformations in MuPDF (which complies with the respective concepts laid down in the :ref:`AdobeManual`). With matrices you can manipulate the rendered image of a page in a variety of ways: (parts of) the page can be rotated, zoomed, flipped, sheared and shifted by setting some or all of just six float values.
1010

1111

12-
Since all points or pixels live in a two-dimensional space, one column vector of that matrix is a constant unit vector, and only the remaining six elements are used for manipulations. These six elements are usually represented by *[a, b, c, d, e, f]*. Here is how they are positioned in the matrix:
12+
Since all points or pixels live in a two-dimensional space, one column vector of that matrix is a constant unit vector, and only the remaining six elements are used for manipulations. These six elements are usually represented by `[a, b, c, d, e, f]`. Here is how they are positioned in the matrix:
1313

1414
.. image:: images/img-matrix.*
1515

docs/module.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Example: To join the following files
164164

165165
and store the result as **output.pdf** enter this command:
166166

167-
*pymupdf join -o output.pdf file1.pdf,,N-1 file2.pdf,secret,N,1 file3.pdf,,5-N*
167+
``pymupdf join -o output.pdf file1.pdf,,N-1 file2.pdf,secret,N,1 file3.pdf,,5-N``
168168

169169

170170
Low Level Information

docs/outline.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Outline
77
================
88

9-
*outline* (or "bookmark"), is a property of *Document*. If not ``None``, it stands for the first outline item of the document. Its properties in turn define the characteristics of this item and also point to other outline items in "horizontal" or downward direction. The full tree of all outline items for e.g. a conventional table of contents (TOC) can be recovered by following these "pointers".
9+
The document outline (otherwise known as "bookmarks") is a property of :ref:`Document` (see :attr:`Document.outline`). If not ``None``, it stands for the first outline item of the document. Its properties in turn define the characteristics of this item and also point to other outline items in "horizontal" or downward direction. The full tree of all outline items for e.g. a conventional table of contents (TOC) can be recovered by following these "pointers".
1010

1111
============================ ==================================================
1212
**Method / Attribute** **Short Description**

docs/pixmap.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ Have a look at the :ref:`FAQ` section to see some pixmap usage "at work".
9191
:type colorspace: :ref:`Colorspace`
9292

9393
:arg source: the source pixmap.
94-
:type source: ``Pixmap``
94+
:type source: :ref:`Pixmap`.
9595

9696
.. method:: __init__(self, source, mask)
9797

@@ -100,17 +100,17 @@ Have a look at the :ref:`FAQ` section to see some pixmap usage "at work".
100100
**Copy and add image mask:** Copy *source* pixmap, add an alpha channel with transparency data from a mask pixmap.
101101

102102
:arg source: pixmap without alpha channel.
103-
:type source: :ref:`Pixmap`
103+
:type source: :ref:`Pixmap`.
104104

105105
:arg mask: a mask pixmap. Must be a graysale pixmap.
106-
:type mask: :ref:`Pixmap`
106+
:type mask: :ref:`Pixmap`.
107107

108108
.. method:: __init__(self, source, width, height, [clip])
109109

110110
**Copy and scale:** Copy *source* pixmap, scaling new width and height values -- the image will appear stretched or shrunk accordingly. Supports partial copying. The source colorspace may be ``None``.
111111

112112
:arg source: the source pixmap.
113-
:type source: ``Pixmap``
113+
:type source: :ref:`Pixmap`.
114114

115115
:arg float width: desired target width.
116116

@@ -125,7 +125,7 @@ Have a look at the :ref:`FAQ` section to see some pixmap usage "at work".
125125
**Copy and add or drop alpha:** Copy *source* and add or drop its alpha channel. Identical copy if *alpha* equals *source.alpha*. If an alpha channel is added, its values will be set to 255.
126126

127127
:arg source: source pixmap.
128-
:type source: ``Pixmap``
128+
:type source: :ref:`Pixmap`.
129129

130130
:arg bool alpha: whether the target will have an alpha channel, default and mandatory if source colorspace is ``None``.
131131

@@ -394,7 +394,7 @@ Have a look at the :ref:`FAQ` section to see some pixmap usage "at work".
394394
Create a Pillow Image from the pixmap. PIL / Pillow must be installed.
395395

396396
:raises ImportError: if Pillow is not installed.
397-
:returns: a ˇˇPIL.Imageˇˇ object
397+
:returns: a ``PIL.Image`` object
398398

399399
.. method:: pil_save(*args, unmultiply=False, **kwargs)
400400

@@ -406,7 +406,7 @@ Have a look at the :ref:`FAQ` section to see some pixmap usage "at work".
406406

407407
A simple example: `pix.pil_save("some.webp", optimize=True, dpi=(150, 150))`.
408408

409-
:arg bool unmultiply: If the pixmap's colorspace is RGB with transparency, the alpha values may or may not already be multiplied into the color components ref/green/blue (called "premultiplied"). To enforce undoing premultiplication, set this parameter to `True`. To learn about some background, e.g. look for "Premultiplied alpha" `here <https://en.wikipedia.org/wiki/Glossary_of_computer_graphics#P>`_.
409+
:arg bool unmultiply: If the pixmap's colorspace is RGB with transparency, the alpha values may or may not already be multiplied into the color components ref/green/blue (called "premultiplied"). To enforce undoing premultiplication, set this parameter to `True`. To learn about some background, e.g. look for `"Premultiplied alpha" on this page <https://en.wikipedia.org/wiki/Glossary_of_computer_graphics#P>`_.
410410

411411

412412
For details on other parameters see the Pillow documentation.

0 commit comments

Comments
 (0)