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