Skip to content

@techandsofware/teletext

This package renders teletext pages using vector graphics (SVG). Note that this implements the display part of teletext, not the VBI packets, and operates as a screen or a dumb terminal. The application using this package will need to supply the page content, implement page numbers, navigation, etc. The package provides an API to set page content and change the display characteristics such as the screen height and aspect ratio.

This supports all of level 1 and level 1.5, and a little of level 2.5. A full list follows. Display rendering features include changing the text font (including proportional fonts), aspect ratio and screen height. Mosaic graphics can be rendered with a font or using SVG graphics.

Extensions are supported via plugins.

See also these packages:

  • @techandsoftware/teletext-service, a higher level package with page numbers, subpage and colour button navigation. This can be used as the basis of an application.
  • @techandsoftware/teletext-caster, Chromecast integration, for displaying teletext on Chromecast and compatible TVs. This is clearly what Google intended all along.
  • @techandsoftware/teletext-plugin-smooth-mosaic, a plugin which applies a pixel-art scaling algorithm to the block mosaics to create higher resolution graphics. The algorithm used is hqx by Maxim Stepin. The result isn't authentic teletext, but this can create a satisfying result. This is unrelated to the G3 character set in level 2.5, which contains smooth mosaic characters.
  • @techandsoftware/teletext-fonts is a helper package which contains a couple of fonts equipped with block mosaic characters (sextants). This is optional and unnecessary if rendering the mosaics graphically via setView().
  • @techandsoftware/image-to-sextants converts an image to Unicode sextant or teletext block mosaic characters.

See also these sites:

  • Geefax is a web-based teletext service, using content from the Guardian via their API, which demonstrates the packages above.

Teletext features supported

As a quick intro, teletext is a technical standard for showing pages of text and semigraphics on TV screens, devised in 1976 by the BBC and IBA. The spec for the most recent version of World Standard Teletext is ETSI EN 300 706. It's still used in Europe, where it's used for broadcast TV. Its a cousin of Viewdata. UK broadcast subtitles still use the 7-bit character set defined by teletext despite newer systems being available.

The levels are for different capabilities, defined in the teletext spec.

  • Level 1

    • A base page, or screen size of 40 x 25 characters
    • 6 colour foreground text or mosaic characters (also called semigraphics or sextants)
    • 7 colour background
    • Text displayed using the G0 character sets
    • 20 G0 character sets are available, with up to 96 characters per set. Supports Latin, Greek, Cyrillic, Hebrew and Arabic scripts
    • Primary and secondary G0 sets selectable and switchable
    • Mosaics are contiguous or separated
    • Double height, flashing, concealed, boxed characters
    • Held mosaic characters, to replace the display of a spacing attributes with the last held graphic
    • Newsflash / subtitles page display mode
    • Mix display mode, which isn't part of the teletext spec but is normal on TVs
  • Level 1.5

    • Black foreground text or mosaic (this is level 2.5 in the teletext spec but included here at 1.5 as with some TVs)
    • G2 character set selectable from 4 available sets (Latin, Greek, Cyrillic and Arabic)
    • Add enhancements to the base page at (row, col) locations:
      • Place characters from the G0 sets
      • Place diacritical marks on characters from the G0 sets
      • Place characters from the G2 sets
      • Place @ symbol (it isn't in most G0 sets or the G2 sets)
      • 4 characters from the G3 character set placeable
  • Level 2.5

    • Double width and double size characters
    • Add enhancements to base page at (row, col) locations:
      • Place characters from the G1 set (block mosaics)
      • Place characters from the G3 set (smooth mosaics and line drawing)

Additional features of this module:

  • API to draw text and graphics on the screen
  • Screen is rendered with SVG graphics. The SVG is exportable for display in any SVG viewer without needing Javascript, and is fully scalable to any resolution
  • The API supports setting the font for text, change the height and aspect ratio, switch teletext levels, and set an on-screen grid
  • Use characters or SVG shapes for rendering mosaics
  • Plugin architecture. Plugins can supplement or overwrite the rendering

Plugins

Demos

  • See demos for several text and graphic demos.
  • See Geefax for a full service in a web app.

License

The project is licensed under GNU Affero General Public License 3 (AGPL-3.0-only). For commercial support and integration enquiries, contact [email protected].

The fonts supplied in the demo/fonts directory of the repo have their own licenses. See the *.license files in that directory.

This package is compliant with REUSE 3.

TODO

These features of ETSI EN 300 706 aren't supported yet. I'm not sure how much is worth doing:

At Level 2.5 or 3.5:

  • non-spacing attributes. The non-spacing attributes include underline, inverse, bold, italic, proportional text and extra flashing modes in addition to the normal level 1 attributes
  • 32 colours via 4 colour tables
  • colour table selection and remapping
  • default screen/row colours
  • side panels
  • redefinable characters
  • modified G0/G2 set selectable for use with enhancements

The spec also defines navigation and object pages, which I consider out of scope as they're more in the domain of the application rather than the display.

Bugs

If you encounter any issues, contact [email protected]

Here's a few callouts:

  • Character 5f in the G3 set - a transparent cell - isn't supported yet
  • When a font is used for rendering the mosaic characters, the separated form of the mosaics uses private use characters compatible with the Unscii font. Unicode 16 has since added the separated mosaics to Unicode, so these characters need to be updated. This doesn't effect graphical rendering of the mosaic characters

Credits