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/tostr.h"
19 /* the names used by TeX and XWindows for deadkeys/accents are not the same
20 so here follows a table to clearify the differences. Please correct this
23 |------------------|------------------|------------------|--------------|
24 | TeX | XWindows | \bind/LFUN | used by intl |
25 |------------------|------------------|------------------|--------------|
26 | grave | grave |LFUN_GRAVE | grave
27 | acute | acute |LFUN_ACUTE | acute
28 | circumflex | circumflex |LFUN_CIRCUMFLEX | circumflex
29 | umlaut/dieresis | diaeresis |LFUN_UMLAUT | umlaut
30 | tilde | tilde |LFUN_TILDE | tilde
31 | macron | maron |LFUN_MACRON | macron
32 | dot | abovedot |LFUN_DOT | dot
33 | cedilla | cedilla |LFUN_CEDILLA | cedilla
34 | underdot | |LFUN_UNDERDOT | underdot
35 | underbar | |LFUN_UNDERBAR | underbar
36 | hácek | caron |LFUN_CARON | caron
37 | breve | breve |LFUN_BREVE | breve
38 | tie | |LFUN_TIE | tie
39 | Hungarian umlaut | doubleacute |LFUN_HUNG_UMLAUT | hungarian umlaut
40 | circle | abovering |LFUN_CIRCLE | circle
44 | | semivoiced_sound | |
45 | | |LFUN_SPECIAL_CARON| special caron
47 // I am not sure how some of the XWindows names coresponds to the TeX ones.
49 tex_accent_struct lyx_accent_table[18] = {
50 { static_cast<tex_accent>(0), "", /*"",*/ "", static_cast<kb_action>(0)},
51 {TEX_ACUTE, "\\'", /*" AEIOUYaeiouySZszRLCNrlcn",*/ "acute", LFUN_ACUTE},
52 {TEX_GRAVE, "\\`", /*" aeiouAEIOU",*/ "grave", LFUN_GRAVE},
53 {TEX_MACRON, "\\=", /*" EeAIOUaiou",*/ "macron", LFUN_MACRON},
54 {TEX_TILDE, "\\~", /*" ANOanoIiUu",*/ "tilde", LFUN_TILDE},
55 {TEX_UNDERBAR, "\\b", /*" ",*/ "underbar", LFUN_UNDERBAR},
56 {TEX_CEDILLA, "\\c", /*" CcSsTtRLGrlgNKnk",*/ "cedilla", LFUN_CEDILLA},
57 {TEX_UNDERDOT, "\\d", /*" ",*/ "underdot", LFUN_UNDERDOT},
58 {TEX_CIRCUMFLEX, "\\^", /*" AEIOUaeiouHJhjCGScgs",*/ "circumflex", LFUN_CIRCUMFLEX},
59 {TEX_CIRCLE, "\\r", /*" AaUu",*/ "circle", LFUN_CIRCLE},
60 {TEX_TIE, "\\t", /*" ",*/ "tie", LFUN_TIE},
61 {TEX_BREVE, "\\u", /*" AaGgUu",*/ "breve", LFUN_BREVE},
62 {TEX_CARON, "\\v", /*" LSTZlstzCEDNRcednr",*/ "caron", LFUN_CARON},
63 // {TEX_SPECIAL_CARON, "\\q", "", "ooo", LFUN_SPECIAL_CARON},
64 {TEX_HUNGUML, "\\H", /*" OUou",*/ "hugarian_umlaut", LFUN_HUNG_UMLAUT},
65 {TEX_UMLAUT, "\\\"", /*" AEIOUaeiouy",*/ "umlaut", LFUN_UMLAUT},
66 {TEX_DOT, "\\.", /*" ZzICGicgEe",*/ "dot", LFUN_DOT},
67 {TEX_OGONEK, "\\k", /*" AaEe",*/ "ogonek", LFUN_OGONEK},
68 { static_cast<tex_accent>(0), "", /*"",*/ "", static_cast<kb_action>(0)}};
71 tex_accent_struct get_accent(kb_action action)
74 while (i <= TEX_MAX_ACCENT) {
75 if (lyx_accent_table[i].action == action)
76 return lyx_accent_table[i];
79 struct tex_accent_struct temp = { static_cast<tex_accent>(0), 0,
80 0, static_cast<kb_action>(0)};
85 string const DoAccent(string const & s, tex_accent accent)
89 res += lyx_accent_table[accent].cmd;
91 if (s == "i" || s == "j") {
100 string const DoAccent(char c, tex_accent accent)
102 return DoAccent(tostr(c), accent);