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