36 Commits

Author SHA1 Message Date
Matan Ziv-Av
c8b94b8780 Override width of YiJing Hexagram Symbols Unicode characters (0x4dc0-0x4dff)
Their Unicode width is 1, but GNU libc's wcwidth and libreadline
override it to 2, so it makes sense to follow suit.

The profile option "ignore wcwidth" returns the width to 1, if
enabled, so it allows the old behavior if it desired. 

BUG: 421625
2024-04-02 19:30:28 +00:00
Kurt Hindenburg
1b3990ac86 Add note that uni2characterwidth tool doesn't build with Qt6 2024-02-23 17:59:32 -05:00
Laurent Montel
73295a8557 Use std::as_const (we depend against c++17) 2023-10-27 05:52:51 +00:00
Waqar Ahmed
1e136d63f2 move konsole to kf6 2023-10-25 22:13:53 +05:00
Tobias Fella
53d473cff3 Port to KF6 2023-05-29 16:17:23 +00:00
Laurent Montel
2ddb680bee Remove unused includes 2022-09-28 04:50:24 +00:00
Ahmad Samir
305e699a57 Adapt build system to building with Qt5 and Qt6
By default it builds with Qt5 (KDEInstallDirs module from ECM takes care of
that), to build with Qt6 you need to build with -DQT_MAJOR_VERSION=6.
2022-06-01 14:35:49 +00:00
Arjan Veenstra
bd7018da19 Document setting multiple properties with konsoleprofile
When using konsoleprofile multiple settings can be specified separated by
semicolons. The usage output and documenting comments now reflect this.
Also fixes the link to Profile.h.
2022-05-16 19:56:21 +00:00
Luis Javier Merino Morán
cfff2326f9 Make non-initial Korean Hangul Jamo width 0
Korean Hangul can be represented in Unicode either as precomposed Hangul
syllables, or as sequences of alphabetic components called Jamo.

Syllables should occupy 2 cells (there are halfwidth variants at
U+FFA0..U+FFDF).  A fully decomposed syllable consists of an initial
jamo (choseong - leading consonant - may be a filler U+115F), a medial
jamo (jungseong - vowel - may be a filler U+1160), and an optional final
jamo (jongseong - trailing consonant).  Old Korean can have more than
one of each of those.  In any case, to make the total width 2, we assign
width 2 to choseong, and 0 to jungseong and jongseong, which, absent a
context-aware wcswidth, will still break with Old Korean syllables with
more than one jamo for leading consonants.

This aligns with glibc:

commit 7a79e321c6f85b204036c33d85f6b2aa794e7c76
Author: Thorsten Glaser <tg@mirbsd.de>
Date:   Fri Jul 14 14:02:50 2017 +0200

    Refresh generated charmap data and ChangeLog

            [BZ #21750]
            * charmaps/UTF-8: Refresh.

diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 04ef5ad071..9e05b4a652 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,17 @@
+2017-07-14  Thorsten Glaser  <tg@mirbsd.de>
+
+       [BZ #21750]
+       * charmaps/UTF-8: Refresh.
+       * unicode-gen/utf8_gen.py (U+00AD): Set width to 1.
+       * unicode-gen/utf8_gen.py (U+1160..U+11FF): Set width to 0.
+       * unicode-gen/utf8_gen.py (U+3248..U+324F): Set width to 2.
+       * unicode-gen/utf8_gen.py (U+4DC0..U+4DFF): Likewise.
+       * unicode-gen/utf8_gen.py: Treat category Me and Mn as combining.
+       [BZ #19852]
+       * unicode-gen/utf8_gen.py: Process EastAsianWidth lines before
+       UnicodeData lines so the latter have precedence; remove hack
+       to group output by EastAsianWidth ranges.
+

[ ... snip ...]

commit 6e540caa21616d5ec5511fafb22819204525138e
Author: Mike FABIAN <mfabian@redhat.com>
Date:   Tue Jun 16 08:29:40 2020 +0200

    Set width of JUNGSEONG/JONGSEONG characters from UD7B0 to UD7FB to 0 [BZ #26120]

    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

diff --git a/localedata/charmaps/UTF-8 b/localedata/charmaps/UTF-8
index 14c5d4fa33..8cce47cd97 100644
--- a/localedata/charmaps/UTF-8
+++ b/localedata/charmaps/UTF-8
@@ -48920,6 +48920,8 @@ WIDTH
 <UABE8>        0
 <UABED>        0
 <UAC00>...<UD7A3>      2
+<UD7B0>...<UD7C6>      0
+<UD7CB>...<UD7FB>      0
 <UF900>...<UFA6D>      2
 <UFA70>...<UFAD9>      2
 <UFB1E>        0
2021-12-28 17:06:27 +00:00
Ahmad Samir
d1c826adc8 Tweak formatting after running clang-format
GIT_SILENT
2021-09-06 12:51:53 +02:00
Ahmad Samir
97569b764c Run clang-format on the whole repo
Also install the relevant git hook.

GIT_SILENT
2021-09-06 12:51:39 +02:00
Kurt Hindenburg
64dbb83d01 Port away from deprecated ::endl to Qt::endl 2021-04-17 13:15:50 -04:00
Carlos Alves
d351756c77 OptimizeOnFirstUsageOption is ignored by compiler
This option is deprecated on Qt since 5.12. Konsole cmake minimal Qt
version set is 5.12, giving warning messages while making.
A regular expression is automatically optimized the first time it is
used now.
2020-11-19 10:46:14 -03:00
Kurt Hindenburg
600f68de2a Convert tools to use SPDX license/copyright
https://community.kde.org/Policies/Licensing_Policy#SPDX_Statements
https://community.kde.org/Guidelines_and_HOWTOs/Licensing
2020-11-12 09:07:00 -05:00
Laurent Montel
b626359501 If include is define in .h remove it if it's defined in .cpp too (scripted) 2020-10-23 07:45:13 +02:00
Kurt Hindenburg
399ba9eb1f Use https for URLs 2020-06-19 20:30:41 -04:00
Kurt Hindenburg
0eb1c7e8ff Update konsoleprofile link for info 2020-06-19 20:28:25 -04:00
Mariusz Glebocki
52d2720007 Revert "GIT_SILENT: minor qstring optimization"
This reverts commit f96deb39aa.

This was anti-optimization.
QStringLiteral is a QString created at build time. Initialization of
QString with it has no overhead.
QLatin1String is 8 bit C string wrapper which needs run-time conversion
to 16 bit encoding used in QString.
2019-12-17 21:04:14 -05:00
Laurent Montel
f96deb39aa GIT_SILENT: minor qstring optimization 2019-09-07 13:33:09 +02:00
Laurent Montel
ef1beaab86 Remove unused includes 2019-08-23 08:09:17 +02:00
Patrick José Pereira
8ba91ade55 template: check order before access
Summary: Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>

Reviewers: tcanabrava

Reviewed By: tcanabrava

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D21325
2019-05-21 18:23:53 -03:00
Mariusz Glebocki
13132fc77b Improve built-in line/block characters drawing
Summary:
* Fix bold lines (BUG 402415).
* Make drawing pixel-perfect.
* Make line width proportional to font size.
* Move relevant code to separate file and namespace.
* Remove code for checking supported line characters from Character
  class. Information about what is supported is now in one place
  together width drawing code.
* Remove fontembedder/LineFont files (no longer used).
* Add test script for displaying supported characters table.
* Add triple and quadruple dashes (U+2504...U+250B).
* Change shade block characters (U+2591...U+2593) look. When
  antialiasing is turned on, shades are drawn as transculent solid
  rectangles with 25%, 50% and 75% alpha. This matches the characters
  name/description and their usage. Without antialiasing, previous
  method with patterns is used.

**Screenshots**

Font size: 10pt; character width: 8px
{F6602823}

Font size: 11pt; character width: 9px
{F6602824}

Font size: 12pt; character width: 10px
{F6602825}

Font size: 13-14pt; character width: 11px; w/o antialiasing
{F6602826}

Font size: 13-14pt; character width: 11px
{F6602827}

Font size: 15pt; character width: 12px
{F6602828}

Font size: 6-7pt; character width: 5px
{F6602829}

Font size: 8-9pt; character width: 7px; w/o antialiasing
{F6602830}

Font size: 8-9pt; character width: 7px
{F6602831}

Alignment test (8pt)
{F6602832}

Note: Copyrights in LineBlockCharactersDrawer.cpp are based on
`git blame -w src/TerminalDisplay.cpp` executed before moving the code
to a separate file. Years from first/last commit. Authors sorted by
year. Whitespace-only changes were ignored. Maksim's code was commited
by Waldo Bastian who mentioned him as the author in commit message
(see 5062b40dd).

BUG: 402415

Test Plan:
== Common steps for all tests ==

* Open //Edit Current Profile → Appearance//.
* Turn on //Draw intense colors in bold font//.
* Turn off //Use line characters contained in font//.
* (Optional) select a font which is able to display bold characters in
  Konsole (e.g. DejaVu Sans Mono).

== Check characters validity ==

* Run `./tests/line_block_characters_table.py`.
* Open //Edit Current Profile → Appearance//.
* By switching //Use line characters contained in font// on and off,
  compare built-in characters drawing with characters from a font.
  General shape and line directions must be the same. Small offsets,
  line width differences (as long as proportions between lines in
  a character are kept), and quality differences are allowed.

== Review overall quality ==

* Run `./tests/line_block_characters_table.py`.
* Review glyphs quality in different font sizes.
* Open //Edit Current Profile → Appearance//.
* Toggle //Smooth fonts//, review quality again.

== Check alignment ==

* Display `tests/UTF-8-demo.txt`
* At the bottom of the file you can find a few alignment images. Check
  if all lines align properly. If you're unsure how it should look,
  compare it with font characters by turning on //Use line characters
  contained in font// option.

Reviewers: #konsole, #vdg, fvogt, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, sandsmark, fvogt, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D18735
2019-02-22 18:43:43 +01:00
Mariusz Glebocki
4b2cd7c4d9 Remove code for unsupported Qt versions
Summary:
Since minimum Qt version is 5.9.7, code for older versions is not
needed.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D17746
2018-12-22 22:25:19 -05:00
Kurt Hindenburg
ec5c05751c modernize deprecated header 2018-10-27 22:46:50 -04:00
Kurt Hindenburg
994fdae6f5 Add license and copyright 2018-10-08 21:31:21 -04:00
Yuri Chornoivan
6fb6ac4775 Fix minor EBN issues and typos 2018-10-06 12:20:23 +03:00
Mariusz Glebocki
e74cf6c366 Use new character width code based on Unicode 11
Summary:
Adds a code for getting character width togeter with LUTs generated
using uni2characterwidth from Unicode 11 lists.

Skin tone, flags, gender, and other emoji with and modifer are not
joined (you will see e.g. a skin tone square + generic yellow emoji).
I think joining them would cause problems in most editors, command line
prompts, and other programs which use character width data, as the
characters would behave as combining or emoji depending on context (like
ligatures).

Examples:
* light thumb up: 👍🏻
* dark thumb up:  👍🏿
* Polish flag:    🇵🇱

This behavior is allowed:
* https://unicode.org/reports/tr51/#Emoji_Modifiers_Display
* https://unicode.org/reports/tr51/#Emoji_ZWJ_Sequences

It is possible to add support for sequences, but those would work
only for a string width functions.

Some characters which can be presented as emoji are narrow (e.g. ✖️, ©️).
Those characters are listed without "presentation" mode, which means
they should be rendered as text by default (real presentation depends on
renderer and/or font). Noto Sans Color Emoji renders them as wide,
DejaVu Sans as narrow. Vim, bash and zsh treat them as narrow, so I made
them narrow.

https://unicode.org/reports/tr51/#Presentation_Style

BUG: 396435
BUG: 378124
BUG: 392171
BUG: 339439

FIXED-IN: 18.12

Depends on D15757

Test Plan:
* Look at emoji_test.txt - emojis should look "normal" (two characters
width).
* Look at GLASS.txt - characters width should look correct.
* CharacterWidthTest should pass.
* perl -XCSDL -e 'print map{chr($_), " "} 1..0xffff'

Reviewers: #konsole, #vdg, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, broulik, ngraham, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D15758
2018-10-03 11:11:16 -04:00
Mariusz Glebocki
5f32cb3c44 Add a tool for generating character width tables
Summary:
The uni2characterwidth tool, converts Unicode Character Database files
into character width lookup tables. It uses a template file to place
the tables in a source code file together with a function for finding
the width for specified character. It also allows to generate few forms
of lists with width data for debug and test purposes, or for future use
as a replacement of Unicode files.

Set `KONSOLE_BUILD_UNI2CHARACTERWIDTH` cmake flag to build the tool.
Use `--help` argument for more detailed usage.

There is a possibility to generate separate "width" for Ambiguous
characters. It can be used to add ability to configure the characters
width in Konsole settings.

The `example.template` file contains all possible named tags, and some
additional tags to show how to use them.

CCBUG: 396435

Depends on D15756

Test Plan:
Download files listed below from `11.0.0` and `emoji/11.0` directories
on `https://unicode.org/Public/`. You can also directly use URLs to the
files.

* UnicodeData.txt
* EastAsianWidth.txt
* emoji-data.txt

Generate any available list except compact-ranges (e.g. `details`):

```
uni2characterwidth \
    -U UnicodeData.txt  -A EastAsianWidth.txt  -E emoji-data.txt \
    -g details  result.txt
```

The list should contain ranges for all possible widths
(-2, -1, 0, 1, 2). You can choose some characters with a width you know
and check how they were classified. -2 is a special non-standard width
for ambiguous characters, which can be overriden by adding `-a 1` or
`-a 2` parameter. With this flag, all ranges from -2 group should
disappear and become assigned to selected width (1 or 2).

Generate output using a template:

```
uni2characterwidth \
    -U UnicodeData.txt  -A EastAsianWidth.txt  -E emoji-data.txt \
    -g code,./template.example  result.txt
```

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D15757
2018-09-30 12:22:30 -04:00
Kurt Hindenburg
c9bb564722 Move script konsoleprofile to tools/ directory 2018-07-28 13:53:06 -04:00
Andreas Sturmlechner
977508bc17 Fix build with Qt 5.11_beta3 (dropping qt5_use_modules)
Test Plan: Built fine with Qt 5.11_beta3.

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: hindenburg

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D12241
2018-04-17 17:59:41 +02:00
Kurt Hindenburg
068daf47a7 readability fixes - braces 2018-01-02 21:39:59 -05:00
Kurt Hindenburg
ee61cc5ece modernize use nullptr 2017-07-01 21:31:30 -04:00
Kurt Hindenburg
25857cb0ec Do not specify Qt modules in includes 2017-04-27 20:35:19 -04:00
Kurt Hindenburg
5648ec1a1a Use QLatin1* to handle casts from ascii 2017-04-16 14:16:21 -04:00
Kurt Hindenburg
be5c66a0bf use auto range loops 2017-04-01 14:27:29 -04:00
Kurt Hindenburg
a0d2900f1e Move fontembedder to a new tools sub-folder
fontembedder is a small tool used to regenerate LineFont.h from
LineFont.src
2016-05-28 16:09:55 -04:00