Skip to content

About

A teletext editor and viewer in your pocket...

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Teletexting: A teletext editor and viewer in your pocket

App Icon

A vibe-coded pure native Android application for viewing and editing teletext pages in multiple historical formats.

๐Ÿ“‹ Project Specifications

  • Package Name: bg.alesla.teletexting
  • Minimum SDK: 23 (Android 6.0)
  • Target SDK: 33 (Android 13)
  • Language: Kotlin (100%)
  • UI: XML layouts

๐ŸŽฏ Core Features

File Format Support

The application supports 6 teletext formats and 1 image format:

  1. MRG Systems TTI (Teletext Interchange) - .tti
  2. 7-bit Escaped TTI (TTI eXtended) - .ttix
  3. Softel EP1 (Softel Page 1) - .ep1
  4. Teletext Packets (T42) - .t42
  5. Binary Dump (Raw page data) - .bin
  6. Cebra Teletext TTX - .ttx (the app doesn't parse it properly, for future improvement)
  7. Hi-Resolution PNG (Export only) - .png

Teletext Rendering Engine

The custom TeletextView implements Level 1 teletext specifications:

  • Grid System: 40 columns ร— 25 rows
  • Level 1 Control Codes:
    • Text colors (Red, Green, Yellow, Blue, Magenta, Cyan, White, Black)
    • Graphics colors, and mosaic characters
    • Flash attribute (animated at 500ms intervals)
    • Double height text
    • Background colors (Black background, New background)
    • Hold graphics
    • Separated/Contiguous graphics
  • Multilingual support: 13 different charsets

Editing Features

  • File Operations: Open, Save, Save As using Android Storage Access Framework
  • Page Navigation: Previous/Next page buttons, and specific magazine/page/subpage selection
  • Cursor Control: Tap any cell to place the cursor
  • Character Input: Tap cursor position to enter characters
  • Attribute Toggling: Insert flash and other control codes
  • Color Palette: Quick access to 8 teletext colors in 2 modes: alphanumeric and mosaic symbols
  • Visual Toggles: Show/hide grid and control codes, black and white mode
  • Page Editing Options: Select, copy, cut, and paste entire rows or regions of teletext pages

Status Display

The status bar shows:

  • Page Address: Current page/subpage number
  • Character Position: Column and row coordinates
  • Hex Value: Character code at cursor
  • CRC Status: Data integrity indicator (Green = valid, Red = invalid)

๐Ÿ“ Project Structure

bg.alesla.teletexting/
โ”œโ”€โ”€ MainActivity.kt              # Main application activity
โ”œโ”€โ”€ view/
โ”‚   โ””โ”€โ”€ TeletextView.kt         # Custom rendering view
โ”œโ”€โ”€ parsers/
โ”‚   โ”œโ”€โ”€ TTIParser.kt            # MRG Systems TTI format
โ”‚   โ”œโ”€โ”€ TTIxParser.kt           # 7-bit Escaped TTIx format
โ”‚   โ”œโ”€โ”€ EP1Parser.kt            # Softel EP1 format
โ”‚   โ”œโ”€โ”€ T42Parser.kt            # Teletext Packets
โ”‚   โ”œโ”€โ”€ BinaryParser.kt         # Raw binary format
โ”‚   โ””โ”€โ”€ TTXParser.kt            # Cebra TTX format
โ”œโ”€โ”€ utils/
โ”‚   โ””โ”€โ”€ CRCCalculator.kt        # Data integrity checking
โ””โ”€โ”€ res/
    โ”œโ”€โ”€ layout/
    โ”‚   โ””โ”€โ”€ activity_main.xml   # Main UI layout
    โ””โ”€โ”€ menu/
        โ””โ”€โ”€ main_menu.xml       # Application menu

๐Ÿ”ง Technical Implementation

TeletextView.kt

Custom View implementing teletext rendering:

  • Attribute Processing: Scans each row left-to-right, tracking control code states
  • Background Drawing: Respects double-height cells (spans 2 rows)
  • Character Rendering: Uses custom pixelated fonts with proper baseline alignment
  • Double Height: Single character drawn at 2ร— size spanning two cells, with proper clipping
  • Mosaic Graphics: Draws 6-sixel graphics based on bit patterns
  • Flash Animation: Toggles visibility every 500ms via Handler
  • Gesture Detection: Touch coordinates scaled for proper cursor positioning
  • Custom Fonts: Supports external TTF fonts for authentic teletext appearance

Parser Architecture

Each parser implements:

  • parse(): Converts format-specific bytes/text to standard Array<IntArray> (25ร—40)
  • serialize(): Converts page data back to format-specific output

TTI Format

  • Text-based with escape sequences
  • Control codes escaped as ESC + (code + 0x40)
  • Metadata: Page number, description, charset

TTIx Format

  • Almost the same as TTI - text-based with escape sequences
  • Control codes converted/escaped to fit within 7-bit ASCII by using Prestel escape codes

EP1 Format

  • Binary with 6-byte header: 0xFE 0x01 [4 bytes]
  • 960 bytes of page data (25 rows ร— 40 columns)

T42 Format

  • 42-byte packets: 2 address bytes + 40 data bytes
  • Hamming 8/4 encoding for addresses
  • Row 0 contains the page number in the Hamming-encoded header

TTX Format

  • Similar to T42 with 42-byte packets
  • Hamming encoding for addresses and page numbers
  • Data bytes have parity bit set (OR 0x80)

Binary Format

  • Raw 1000 bytes (25 rows ร— 40 columns)
  • No header or metadata
  • Auto-detects EP1 if signature present

CRC Implementation

CRC-16-CCITT algorithm:

  • Polynomial: 0x1021
  • Initial value: 0xFFFF
  • Processes all 1000 bytes of page data

๐ŸŽจ User Interface

Main Layout

  • Toolbar: App title and menu actions
  • ScrollView: Allows panning for a large teletext display
  • TeletextView: Centered rendering canvas
  • Navigation: Page previous/next buttons and address bar with selections
  • Color Palette: 16 color buttons for quick attribute insertion: 8 for alphanumeric, and 8 for mosaic symbols

Menu Options

  • Undo / Redo
  • Open file
  • Save / Save As
  • Export PNG
  • Clear page
  • Start / Extend / Clear selection of a teletext page
  • Copy / Cut / Paste / Insert a single row, or a selection of a page
  • Toggle grid overlay
  • Show control codes
  • Insert flash attribute
  • Delete page
  • Black and White mode

๐Ÿš€ Build Instructions

Prerequisites

  • Android Studio Electric Eel or newer
  • Kotlin plugin 1.7+
  • Gradle 7.4+

Build Steps

  1. Clone/Create Project:

    # Create a new Android project in Android Studio
    # Package: bg.alesla.teletexting
    # Minimum SDK: 23
    # Target SDK: 33
  2. Add Files:

    • Copy all Kotlin files to the corresponding packages
    • Copy XML files to res/layout/ and res/menu/
    • Update AndroidManifest.xml
    • Update build.gradle dependencies
  3. Add Custom Fonts (Optional but Recommended):

    • Create directory: app/src/main/assets/fonts/
    • Add teletext.ttf (normal height font)
    • Add teletext_double.ttf (double height font)
  4. Build:

    ./gradlew assembleDebug
  5. Install:

    ./gradlew installDebug

๐Ÿ“ฑ Usage

Opening Files

  1. Tap Open in toolbar
  2. Select a teletext file (.tti, .ttix, .ep1, .t42, .ttx, .bin)
  3. File loads and displays in a grid

Editing

  1. Tap any cell to move cursor
  2. Tap cursor to enter character
  3. Use color palette to insert color control codes
  4. Menu โ†’ Insert Flash to add flash attribute

Saving

  1. Save to overwrite current file
  2. Save As to create a new file with the selected format
  3. Export As to export the file in another format
  4. Export PNG to create high-resolution image
  5. Export HTML to export the teletext pages in HTML

Navigation

  • Prev/Next buttons for multi-page documents
  • Scroll/zoom the canvas for better visibility

๐Ÿ”’ Permissions

The app requests:

  • READ_EXTERNAL_STORAGE: To open teletext files
  • WRITE_EXTERNAL_STORAGE: To save files (Android 9 and below)

Android 10+ uses Scoped Storage (Storage Access Framework), which doesn't require permissions.

๐Ÿ“š Teletext Specifications

Based on ETSI EN 300 706 standard:

Character Set (Level 1)

  • 0x00-0x1F: Control codes
  • 0x20-0x7F: Displayable characters and graphics

Control Codes

  • 0x00-0x07: Text colors
  • 0x08: Flash
  • 0x09: Steady
  • 0x0C: Normal height
  • 0x0D: Double height
  • 0x10-0x17: Graphics colors
  • 0x19: Contiguous graphics
  • 0x1A: Separated graphics
  • 0x1C: Black background
  • 0x1D: New background
  • 0x1E: Hold graphics
  • 0x1F: Release graphics

Graphics Characters

  • 0x20-0x3F and 0x60-0x7F: Contiguous graphics by default, transformed into separated, using control code 0x1A before their beginning
  • Each character represents 6 sixels (2ร—3 grid)
  • Bit pattern: 0x01=top-left, 0x02=top-right, 0x04=mid-left, 0x08=mid-right, 0x10=bottom-left, 0x40=bottom-right

๐Ÿ”ฎ Future Enhancements

Features for future implementation and improvement:

  • Search and replace
  • Repairing Cebra TTX Parser
  • Level 1.5 features and others

๐Ÿ“„ License

No license specified.

๐Ÿ™ Acknowledgments

  • ETSI EN 300 706: Teletext specification
  • @AndrewNile 's Teletext Meddler SE: Reference implementation
  • Sample files provided for testing

๐Ÿ“ž Support

For issues or questions about this MVP implementation, please refer to the teletext specifications at https://www.etsi.org/deliver/etsi_i_ets/300700_300799/300706/01_60/ets_300706e01p.pdf

About

A teletext editor and viewer in your pocket...

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages