Files
fltk/screenshots/unicode.cxx
Albrecht Schlosser 68d2c48514 Add an option and the first program to create screenshots
This is the first step in creating additional programs for saving
screenshots for documentation purposes. These screenshots must be
saved in the documentation/images directory and checked into the
Git repository.

These programs allow developers to create new screenshots or change
existing ones. More screenshots may be created by programs in the
/test/ folder.

To-do: add more *new* screenshot programs, and if useful, move some
  existing programs from the `/test/` folder to `/screenshots/`,
  such as `test/resize-example*.cxx` and maybe more.
2026-01-04 19:16:53 +01:00

60 lines
2.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// Unicode test program for the Fast Light Tool Kit (FLTK).
//
// Copyright 2025-2026 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
// Generate screenshot with international text
#include <FL/Fl.H>
#include <FL/platform.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/fl_draw.H>
#include <string>
static const char *label_text =
"ISO-8859-15: ¡¢£¤¥¦§¨©ª«¬­®¯ äöüß € µ ÀÁÂÃÄÅÆÇÈÉÊË ðñòóôõö÷øùúû\n"
"Japanese: FLTKは素晴らしいグラフィックライブラリです\n"
"Chinese: FLTK 是一個非常棒的圖形庫\n"
"Greek: Το FLTK είναι μια καταπληκτική βιβλιοθήκη γραφικών\n"
"Korean: FLTK는 훌륭한 그래픽 라이브러리입니다.\n"
"Russian: FLTK — это потрясающая графическая библиотека.\n"
"Hindi: FLTK एक शानदार ग्राफ़िक्स लाइब्रेरी है\n"
"Armenian: FLTK-ն հիանալի գրաֆիկական գրադարան է\n"
"Arab: FLTK هي مكتبة رائعة لواجهات المستخدم الرسومية\n"
"Hebrew: FLTK היא ספריית ממשק משתמש גרפי מעולה";
int main(int argc, char **argv) {
static const Fl_Font font = FL_COURIER;
static const int fsize = 20;
static const Fl_Color bg = Fl_Color(0xf7f7ff00);
fl_open_display();
fl_font(font, fsize);
int bw = 0, bh = 0;
fl_measure(label_text, bw, bh, 0); // measure text
auto win = new Fl_Double_Window(bw + 12, bh + 8, "FLTK international text");
auto box = new Fl_Box(4, 4, bw, bh, label_text);
box->box(FL_FLAT_BOX);
box->color(bg);
box->labelfont(font);
box->labelsize(fsize);
box->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
win->end();
win->color(bg);
win->resizable(box);
win->size_range(win->w(), win->h());
win->show(argc, argv);
return Fl::run();
}