3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Matthias Ettrich
9 * Full author contact details are available in file CREDITS.
14 #include "tex-accent.h"
15 #include "support/convert.h"
20 /* the names used by TeX and XWindows for deadkeys/accents are not the same
21 so here follows a table to clearify the differences. Please correct this
24 |------------------|------------------|------------------|--------------|
25 | TeX | XWindows | \bind/LFUN | used by intl |
26 |------------------|------------------|------------------|--------------|
27 | grave | grave |LFUN_ACCENT_GRAVE | grave
28 | acute | acute |LFUN_ACCENT_ACUTE | acute
29 | circumflex | circumflex |LFUN_ACCENT_CIRCUMFLEX | circumflex
30 | umlaut/dieresis | diaeresis |LFUN_ACCENT_UMLAUT | umlaut
31 | tilde | tilde |LFUN_ACCENT_TILDE | tilde
32 | macron | maron |LFUN_ACCENT_MACRON | macron
33 | dot | abovedot |LFUN_ACCENT_DOT | dot
34 | cedilla | cedilla |LFUN_ACCENT_CEDILLA | cedilla
35 | underdot | |LFUN_ACCENT_UNDERDOT | underdot
36 | underbar | |LFUN_ACCENT_UNDERBAR | underbar
37 | hácek | caron |LFUN_ACCENT_CARON | caron
38 | breve | breve |LFUN_ACCENT_BREVE | breve
39 | tie | |LFUN_ACCENT_TIE | tie
40 | Hungarian umlaut | doubleacute |LFUN_ACCENT_HUNGARIAN_UMLAUT | hungarian umlaut
41 | circle | abovering |LFUN_ACCENT_CIRCLE | circle
45 | | semivoiced_sound | |
46 | | |LFUN_ACCENT_SPECIAL_CARON| special caron
48 // I am not sure how some of the XWindows names coresponds to the TeX ones.
50 tex_accent_struct lyx_accent_table[18] = {
51 { static_cast<tex_accent>(0), "", /*"",*/ "", static_cast<kb_action>(0)},
52 {TEX_ACUTE, "\\'", /*" AEIOUYaeiouySZszRLCNrlcn",*/ "acute", LFUN_ACCENT_ACUTE},
53 {TEX_GRAVE, "\\`", /*" aeiouAEIOU",*/ "grave", LFUN_ACCENT_GRAVE},
54 {TEX_MACRON, "\\=", /*" EeAIOUaiou",*/ "macron", LFUN_ACCENT_MACRON},
55 {TEX_TILDE, "\\~", /*" ANOanoIiUu",*/ "tilde", LFUN_ACCENT_TILDE},
56 {TEX_UNDERBAR, "\\b", /*" ",*/ "underbar", LFUN_ACCENT_UNDERBAR},
57 {TEX_CEDILLA, "\\c", /*" CcSsTtRLGrlgNKnk",*/ "cedilla", LFUN_ACCENT_CEDILLA},
58 {TEX_UNDERDOT, "\\d", /*" ",*/ "underdot", LFUN_ACCENT_UNDERDOT},
59 {TEX_CIRCUMFLEX, "\\^", /*" AEIOUaeiouHJhjCGScgs",*/ "circumflex", LFUN_ACCENT_CIRCUMFLEX},
60 {TEX_CIRCLE, "\\r", /*" AaUu",*/ "circle", LFUN_ACCENT_CIRCLE},
61 {TEX_TIE, "\\t", /*" ",*/ "tie", LFUN_ACCENT_TIE},
62 {TEX_BREVE, "\\u", /*" AaGgUu",*/ "breve", LFUN_ACCENT_BREVE},
63 {TEX_CARON, "\\v", /*" LSTZlstzCEDNRcednr",*/ "caron", LFUN_ACCENT_CARON},
64 // {TEX_SPECIAL_CARON, "\\q", "", "ooo", LFUN_ACCENT_SPECIAL_CARON},
65 {TEX_HUNGUML, "\\H", /*" OUou",*/ "hugarian_umlaut", LFUN_ACCENT_HUNGARIAN_UMLAUT},
66 {TEX_UMLAUT, "\\\"", /*" AEIOUaeiouy",*/ "umlaut", LFUN_ACCENT_UMLAUT},
67 {TEX_DOT, "\\.", /*" ZzICGicgEe",*/ "dot", LFUN_ACCENT_DOT},
68 {TEX_OGONEK, "\\k", /*" AaEe",*/ "ogonek", LFUN_ACCENT_OGONEK},
69 { static_cast<tex_accent>(0), "", /*"",*/ "", static_cast<kb_action>(0)}};
72 tex_accent_struct get_accent(kb_action action)
75 while (i <= TEX_MAX_ACCENT) {
76 if (lyx_accent_table[i].action == action)
77 return lyx_accent_table[i];
80 struct tex_accent_struct temp = { static_cast<tex_accent>(0), 0,
81 0, static_cast<kb_action>(0)};
86 docstring const DoAccent(docstring const & s, tex_accent accent)
90 res += lyx_accent_table[accent].cmd;
92 if (s == "i" || s == "j") {
101 docstring const DoAccent(char_type c, tex_accent accent)
103 return DoAccent(docstring(1, c), accent);