pcface


Namepcface JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryPC Face - Bitmap arrays for all 256 glyphs of CP437
upload_time2023-02-03 09:35:12
maintainer
docs_urlNone
authorSusam Pal
requires_python
licenseMIT
keywords font cp437 retro
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PC Face
=======

PC Face is a collection of programmer-friendly resources to draw
[CP437][CP437WIKI] characters on a graphical canvas.

![CP437 characters rendered on an HTML5 canvas][CP437IMG]

[CP437WIKI]: https://en.wikipedia.org/wiki/Code_page_437
[CP437IMG]: https://susam.github.io/blob/img/pcface/pcface-0.2.0.png


Contents
--------

* [Resources](#resources)
* [Bitmap Format](#bitmap-format)
* [Font Details](#font-details)
* [Credit](#credit)
* [License](#license)
* [Support](#support)
* [Channels](#channels)
* [More](#more)


Resources
---------

There are a number of files available in this project. Here is a brief
description of some of the files:

- [out/fontlist.js](out/fontlist.js): Bitmap representation of all
  CP437 glyphs as a JavaScript array.
- [out/fontmap.js](out/fontmap.js): Bitmap representation of all CP437
  glyphs as a JavaScript object that maps Unicode characters that
  approximate the glyphs to their bitmaps.
- [out/glyph.txt](out/glyph.txt): All CP437 glyphs represented using
  asterisks.
- [out/graph.txt](out/graph.txt): All CP437 glyphs represented using
  the at symbol and dots. Each row of the glyph is prefixed with the
  binary code of the row represented in hexadecimal. The same binary
  codes appear in the JavaScript files mentioned above.

You are free to use these resources or any file available in this
project under the terms of the MIT license. Perhaps you are making a
retro-style game from first principles where you decide what each
pixel should be. Perhaps you are making an ASCII banner to display
CP437 using asterisks or some familiar ASCII character. No matter what
you want to do with the resource files mentioned above, you would
probably have to write some code to translate the bitmap of a
character to pixels on screen. The next section provides more details
about this.

The bitmap array files are also available at the following CDN URLs:

- https://cdn.jsdelivr.net/npm/pcface/out/fontlist.js
- https://cdn.jsdelivr.net/npm/pcface/out/fontmap.js


Bitmap Format
-------------

The format of the bitmaps available in
[out/fontlist.js](out/fontlist.js) and
[out/fontmap.js](out/fontmap.js) is quite simple. Each glyph is
represented with a 8x16 grid of pixels, i.e., 16 rows of pixels with 8
columns in each column. The 16 rows are represented as 16 integers in
the bitmap (a list of integers) for each glyph. For example:

```javascript
  [
    0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66,
    0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00
  ], // [B] (66)
```

Each integer represents the dots that must be plotted for every row of
the glyph. For example, `0x00` and `0x00` above means that the top two
rows are blank. Then `0xfc` (binary `1111100`) means that the first 6
pixels of the third row are plotted with the font colour and the last
two pixels are blank. In this manner, 16 rows of pixels must be
plotted.

Here is an example Python code that reads these bitmaps and plots the
glyph on standard output using a dot (`.`) for every `0` bit and the
at symbol (`@`) for every `1` bit:

```python
bitmap = [
    0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66,
    0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
]
s = ''
for row in bitmap:
    s += f'{row:#04x} ' + f'{row:08b}\n'.translate(str.maketrans('01', '.@'))
print(s)
```

Here is the output:

```
0x00 ........
0x00 ........
0xfc @@@@@@..
0x66 .@@..@@.
0x66 .@@..@@.
0x66 .@@..@@.
0x7c .@@@@@..
0x66 .@@..@@.
0x66 .@@..@@.
0x66 .@@..@@.
0x66 .@@..@@.
0xfc @@@@@@..
0x00 ........
0x00 ........
0x00 ........
0x00 ........
```

If you need more help with writing the code to translate the bitmaps
to pixels, refer to the `drawChar()` function in
[src/fontlist.html](src/fontlist.html) or
[src/fontmap.html](src/fontmap.html) to see an example of how you can
read the bitmap and plot the bitmap on a canvas. You may also refer to
the `drawLine()` function to draw a line of text or the `drawLines()`
function to draw multiple lines of text. It should be possible to
refer to these functions and write similar code for the programming
language and graphical toolkit of your choice.


Font Details
------------

The font used in this project is [Modern DOS 8x16][MDOS] version
20190101.02. This font was developed by Jayvee Enaguas and it is
available under the terms of [CC0 1.0 Universal Public Domain
Dedication][CC0]. A copy of the font is also archived in the
[src/modern-dos/](src/modern-dos/) directory of this project. A
preview of this font is available here:

- [out/preview-8x16.png](out/preview-8x16.png)
- [out/preview-16x32.png](out/preview-16x32.png)

This font is based on the [IBM VGA 8x16][VGA] and [Verite
8x16][VERITE] OEM fonts. Some glyphs in this font look exactly like
the glyphs of IBM VGA 8x16 while some others look exactly like the
glyphs of Verite 8x16. However, there are also several glyphs in this
font that match neither of the two OEM fonts. Instead they happen to
be adaptations of the glyphs found in one or both of the OEM fonts.

In my opinion, Jayvee Enaguas has done an outstanding job of picking
the best parts from both OEM fonts (IBM VGA 8x16 and Verite 8x16) and
fused them together to create this font (Modern DOS 8x16). I like that
this font has the slashed zero of Verite. I also like the more
squarish outline of the letters in Verite that has been inherited into
this font. While it inherits a lot of good design from Verite 8x16, it
also inherits some nice features from IBM VGA 8x16. For example, it
has the raised stem for the digit 2 and the curved stem for the digit
7 from IBM VGA 8x16.

In case, you prefer another PC font, say one of the fonts available at
<https://int10h.org/oldschool-pc-fonts/fontlist/>, you can generate
the resource files and bitmap arrays by running this command at the
top-level directory of this project:

```sh
make venv
venv/bin/python3 src/bitmap.py PATH_TO_TTF_FILE
```

[MDOS]: https://www.dafont.com/modern-dos.font
[CC0]: https://creativecommons.org/publicdomain/zero/1.0/
[VGA]: https://int10h.org/oldschool-pc-fonts/fontlist/font?ibm_vga_8x16
[VERITE]: https://int10h.org/oldschool-pc-fonts/fontlist/font?verite_8x16


Credit
------

Thanks to Jayvee Enaguas for making *Modern DOS* available under the
terms of [CC0 1.0 Universal (CC0 1.0) Public Domain Dedication][CC0].
This project is based on the *8x16* variant of this font.


License
-------

This is free and open source software. You can use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of it,
under the terms of the MIT License. See [LICENSE.md][L] for details.

This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
express or implied. See [LICENSE.md][L] for details.

[L]: LICENSE.md


Support
-------

To report bugs, suggest improvements, or ask questions,
[create issues][ISSUES].

[ISSUES]: https://github.com/susam/pcface/issues


Channels
--------

The author of this project hangs out at the following places online:

- Website: [susam.net](https://susam.net)
- Twitter: [@susam](https://twitter.com/susam)
- Mastodon: [@susam@mastodon.social](https://mastodon.social/@susam)
- GitHub: [@susam](https://github.com/susam)
- Matrix: [#susam:matrix.org](https://app.element.io/#/room/#susam:matrix.org)
- IRC: [#susam:libera.chat](https://web.libera.chat/#susam)

You are welcome to subscribe to, follow, or join one or more of the
above channels to receive updates from the author or ask questions
about this project.


More
----

See [Andromeda Invaders](https://github.com/susam/invaders) where a
small subset of the bitmaps available in this project has been used to
render text on a game canvas.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pcface",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "font,cp437,retro",
    "author": "Susam Pal",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/9c/13/8de9a12c367c9c203f906baa0fb335aee6fe06f243b147f6a6c4bbd649b8/pcface-0.2.0.tar.gz",
    "platform": null,
    "description": "PC Face\n=======\n\nPC Face is a collection of programmer-friendly resources to draw\n[CP437][CP437WIKI] characters on a graphical canvas.\n\n![CP437 characters rendered on an HTML5 canvas][CP437IMG]\n\n[CP437WIKI]: https://en.wikipedia.org/wiki/Code_page_437\n[CP437IMG]: https://susam.github.io/blob/img/pcface/pcface-0.2.0.png\n\n\nContents\n--------\n\n* [Resources](#resources)\n* [Bitmap Format](#bitmap-format)\n* [Font Details](#font-details)\n* [Credit](#credit)\n* [License](#license)\n* [Support](#support)\n* [Channels](#channels)\n* [More](#more)\n\n\nResources\n---------\n\nThere are a number of files available in this project. Here is a brief\ndescription of some of the files:\n\n- [out/fontlist.js](out/fontlist.js): Bitmap representation of all\n  CP437 glyphs as a JavaScript array.\n- [out/fontmap.js](out/fontmap.js): Bitmap representation of all CP437\n  glyphs as a JavaScript object that maps Unicode characters that\n  approximate the glyphs to their bitmaps.\n- [out/glyph.txt](out/glyph.txt): All CP437 glyphs represented using\n  asterisks.\n- [out/graph.txt](out/graph.txt): All CP437 glyphs represented using\n  the at symbol and dots. Each row of the glyph is prefixed with the\n  binary code of the row represented in hexadecimal. The same binary\n  codes appear in the JavaScript files mentioned above.\n\nYou are free to use these resources or any file available in this\nproject under the terms of the MIT license. Perhaps you are making a\nretro-style game from first principles where you decide what each\npixel should be. Perhaps you are making an ASCII banner to display\nCP437 using asterisks or some familiar ASCII character. No matter what\nyou want to do with the resource files mentioned above, you would\nprobably have to write some code to translate the bitmap of a\ncharacter to pixels on screen. The next section provides more details\nabout this.\n\nThe bitmap array files are also available at the following CDN URLs:\n\n- https://cdn.jsdelivr.net/npm/pcface/out/fontlist.js\n- https://cdn.jsdelivr.net/npm/pcface/out/fontmap.js\n\n\nBitmap Format\n-------------\n\nThe format of the bitmaps available in\n[out/fontlist.js](out/fontlist.js) and\n[out/fontmap.js](out/fontmap.js) is quite simple. Each glyph is\nrepresented with a 8x16 grid of pixels, i.e., 16 rows of pixels with 8\ncolumns in each column. The 16 rows are represented as 16 integers in\nthe bitmap (a list of integers) for each glyph. For example:\n\n```javascript\n  [\n    0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66,\n    0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00\n  ], // [B] (66)\n```\n\nEach integer represents the dots that must be plotted for every row of\nthe glyph. For example, `0x00` and `0x00` above means that the top two\nrows are blank. Then `0xfc` (binary `1111100`) means that the first 6\npixels of the third row are plotted with the font colour and the last\ntwo pixels are blank. In this manner, 16 rows of pixels must be\nplotted.\n\nHere is an example Python code that reads these bitmaps and plots the\nglyph on standard output using a dot (`.`) for every `0` bit and the\nat symbol (`@`) for every `1` bit:\n\n```python\nbitmap = [\n    0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66,\n    0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,\n]\ns = ''\nfor row in bitmap:\n    s += f'{row:#04x} ' + f'{row:08b}\\n'.translate(str.maketrans('01', '.@'))\nprint(s)\n```\n\nHere is the output:\n\n```\n0x00 ........\n0x00 ........\n0xfc @@@@@@..\n0x66 .@@..@@.\n0x66 .@@..@@.\n0x66 .@@..@@.\n0x7c .@@@@@..\n0x66 .@@..@@.\n0x66 .@@..@@.\n0x66 .@@..@@.\n0x66 .@@..@@.\n0xfc @@@@@@..\n0x00 ........\n0x00 ........\n0x00 ........\n0x00 ........\n```\n\nIf you need more help with writing the code to translate the bitmaps\nto pixels, refer to the `drawChar()` function in\n[src/fontlist.html](src/fontlist.html) or\n[src/fontmap.html](src/fontmap.html) to see an example of how you can\nread the bitmap and plot the bitmap on a canvas. You may also refer to\nthe `drawLine()` function to draw a line of text or the `drawLines()`\nfunction to draw multiple lines of text. It should be possible to\nrefer to these functions and write similar code for the programming\nlanguage and graphical toolkit of your choice.\n\n\nFont Details\n------------\n\nThe font used in this project is [Modern DOS 8x16][MDOS] version\n20190101.02. This font was developed by Jayvee Enaguas and it is\navailable under the terms of [CC0 1.0 Universal Public Domain\nDedication][CC0]. A copy of the font is also archived in the\n[src/modern-dos/](src/modern-dos/) directory of this project. A\npreview of this font is available here:\n\n- [out/preview-8x16.png](out/preview-8x16.png)\n- [out/preview-16x32.png](out/preview-16x32.png)\n\nThis font is based on the [IBM VGA 8x16][VGA] and [Verite\n8x16][VERITE] OEM fonts. Some glyphs in this font look exactly like\nthe glyphs of IBM VGA 8x16 while some others look exactly like the\nglyphs of Verite 8x16. However, there are also several glyphs in this\nfont that match neither of the two OEM fonts. Instead they happen to\nbe adaptations of the glyphs found in one or both of the OEM fonts.\n\nIn my opinion, Jayvee Enaguas has done an outstanding job of picking\nthe best parts from both OEM fonts (IBM VGA 8x16 and Verite 8x16) and\nfused them together to create this font (Modern DOS 8x16). I like that\nthis font has the slashed zero of Verite. I also like the more\nsquarish outline of the letters in Verite that has been inherited into\nthis font. While it inherits a lot of good design from Verite 8x16, it\nalso inherits some nice features from IBM VGA 8x16. For example, it\nhas the raised stem for the digit 2 and the curved stem for the digit\n7 from IBM VGA 8x16.\n\nIn case, you prefer another PC font, say one of the fonts available at\n<https://int10h.org/oldschool-pc-fonts/fontlist/>, you can generate\nthe resource files and bitmap arrays by running this command at the\ntop-level directory of this project:\n\n```sh\nmake venv\nvenv/bin/python3 src/bitmap.py PATH_TO_TTF_FILE\n```\n\n[MDOS]: https://www.dafont.com/modern-dos.font\n[CC0]: https://creativecommons.org/publicdomain/zero/1.0/\n[VGA]: https://int10h.org/oldschool-pc-fonts/fontlist/font?ibm_vga_8x16\n[VERITE]: https://int10h.org/oldschool-pc-fonts/fontlist/font?verite_8x16\n\n\nCredit\n------\n\nThanks to Jayvee Enaguas for making *Modern DOS* available under the\nterms of [CC0 1.0 Universal (CC0 1.0) Public Domain Dedication][CC0].\nThis project is based on the *8x16* variant of this font.\n\n\nLicense\n-------\n\nThis is free and open source software. You can use, copy, modify,\nmerge, publish, distribute, sublicense, and/or sell copies of it,\nunder the terms of the MIT License. See [LICENSE.md][L] for details.\n\nThis software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nexpress or implied. See [LICENSE.md][L] for details.\n\n[L]: LICENSE.md\n\n\nSupport\n-------\n\nTo report bugs, suggest improvements, or ask questions,\n[create issues][ISSUES].\n\n[ISSUES]: https://github.com/susam/pcface/issues\n\n\nChannels\n--------\n\nThe author of this project hangs out at the following places online:\n\n- Website: [susam.net](https://susam.net)\n- Twitter: [@susam](https://twitter.com/susam)\n- Mastodon: [@susam@mastodon.social](https://mastodon.social/@susam)\n- GitHub: [@susam](https://github.com/susam)\n- Matrix: [#susam:matrix.org](https://app.element.io/#/room/#susam:matrix.org)\n- IRC: [#susam:libera.chat](https://web.libera.chat/#susam)\n\nYou are welcome to subscribe to, follow, or join one or more of the\nabove channels to receive updates from the author or ask questions\nabout this project.\n\n\nMore\n----\n\nSee [Andromeda Invaders](https://github.com/susam/invaders) where a\nsmall subset of the bitmaps available in this project has been used to\nrender text on a game canvas.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "PC Face - Bitmap arrays for all 256 glyphs of CP437",
    "version": "0.2.0",
    "split_keywords": [
        "font",
        "cp437",
        "retro"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a60728e895c57e8989c6e71b8267cc0092ffa4ebcc3cda0149dc7431bbdc32a",
                "md5": "b1626b452382ece070d5a7ec2fbfec76",
                "sha256": "649daf8ba6fc273d6629f3164784800aa015177e033b8157829bc2ed673cba07"
            },
            "downloads": -1,
            "filename": "pcface-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b1626b452382ece070d5a7ec2fbfec76",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7290,
            "upload_time": "2023-02-03T09:35:10",
            "upload_time_iso_8601": "2023-02-03T09:35:10.262556Z",
            "url": "https://files.pythonhosted.org/packages/3a/60/728e895c57e8989c6e71b8267cc0092ffa4ebcc3cda0149dc7431bbdc32a/pcface-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c138de9a12c367c9c203f906baa0fb335aee6fe06f243b147f6a6c4bbd649b8",
                "md5": "4e084c06643c7687d60b0de325b4c1f8",
                "sha256": "29eaa4ad169ea4fcfed13585b538c482c5d913adfd3432731c69ac1d587121ef"
            },
            "downloads": -1,
            "filename": "pcface-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4e084c06643c7687d60b0de325b4c1f8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6397,
            "upload_time": "2023-02-03T09:35:12",
            "upload_time_iso_8601": "2023-02-03T09:35:12.325381Z",
            "url": "https://files.pythonhosted.org/packages/9c/13/8de9a12c367c9c203f906baa0fb335aee6fe06f243b147f6a6c4bbd649b8/pcface-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-03 09:35:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pcface"
}
        
Elapsed time: 0.04413s