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"
24 /* the names used by TeX and XWindows for deadkeys/accents are not the same
25 so here follows a table to clearify the differences. Please correct this
28 |------------------|------------------|------------------|--------------|
29 | TeX | XWindows | \bind/LFUN | used by intl |
30 |------------------|------------------|------------------|--------------|
31 | grave | grave |LFUN_ACCENT_GRAVE | grave
32 | acute | acute |LFUN_ACCENT_ACUTE | acute
33 | circumflex | circumflex |LFUN_ACCENT_CIRCUMFLEX | circumflex
34 | umlaut/dieresis | diaeresis |LFUN_ACCENT_UMLAUT | umlaut
35 | tilde | tilde |LFUN_ACCENT_TILDE | tilde
36 | macron | maron |LFUN_ACCENT_MACRON | macron
37 | dot | abovedot |LFUN_ACCENT_DOT | dot
38 | cedilla | cedilla |LFUN_ACCENT_CEDILLA | cedilla
39 | underdot | |LFUN_ACCENT_UNDERDOT | underdot
40 | underbar | |LFUN_ACCENT_UNDERBAR | underbar
41 | hácek | caron |LFUN_ACCENT_CARON | caron
42 | breve | breve |LFUN_ACCENT_BREVE | breve
43 | tie | |LFUN_ACCENT_TIE | tie
44 | Hungarian umlaut | doubleacute |LFUN_ACCENT_HUNGARIAN_UMLAUT | hungarian umlaut
45 | circle | abovering |LFUN_ACCENT_CIRCLE | circle
49 | | semivoiced_sound | |
50 | | |LFUN_ACCENT_SPECIAL_CARON| special caron
52 // I am not sure how some of the XWindows names coresponds to the TeX ones.
54 tex_accent_struct lyx_accent_table[18] = {
55 { static_cast<tex_accent>(0), "", /*"",*/ "", static_cast<kb_action>(0)},
56 {TEX_ACUTE, "\\'", /*" AEIOUYaeiouySZszRLCNrlcn",*/ "acute", LFUN_ACCENT_ACUTE},
57 {TEX_GRAVE, "\\`", /*" aeiouAEIOU",*/ "grave", LFUN_ACCENT_GRAVE},
58 {TEX_MACRON, "\\=", /*" EeAIOUaiou",*/ "macron", LFUN_ACCENT_MACRON},
59 {TEX_TILDE, "\\~", /*" ANOanoIiUu",*/ "tilde", LFUN_ACCENT_TILDE},
60 {TEX_UNDERBAR, "\\b", /*" ",*/ "underbar", LFUN_ACCENT_UNDERBAR},
61 {TEX_CEDILLA, "\\c", /*" CcSsTtRLGrlgNKnk",*/ "cedilla", LFUN_ACCENT_CEDILLA},
62 {TEX_UNDERDOT, "\\d", /*" ",*/ "underdot", LFUN_ACCENT_UNDERDOT},
63 {TEX_CIRCUMFLEX, "\\^", /*" AEIOUaeiouHJhjCGScgs",*/ "circumflex", LFUN_ACCENT_CIRCUMFLEX},
64 {TEX_CIRCLE, "\\r", /*" AaUu",*/ "circle", LFUN_ACCENT_CIRCLE},
65 {TEX_TIE, "\\t", /*" ",*/ "tie", LFUN_ACCENT_TIE},
66 {TEX_BREVE, "\\u", /*" AaGgUu",*/ "breve", LFUN_ACCENT_BREVE},
67 {TEX_CARON, "\\v", /*" LSTZlstzCEDNRcednr",*/ "caron", LFUN_ACCENT_CARON},
68 // {TEX_SPECIAL_CARON, "\\q", "", "ooo", LFUN_ACCENT_SPECIAL_CARON},
69 {TEX_HUNGUML, "\\H", /*" OUou",*/ "hugarian_umlaut", LFUN_ACCENT_HUNGARIAN_UMLAUT},
70 {TEX_UMLAUT, "\\\"", /*" AEIOUaeiouy",*/ "umlaut", LFUN_ACCENT_UMLAUT},
71 {TEX_DOT, "\\.", /*" ZzICGicgEe",*/ "dot", LFUN_ACCENT_DOT},
72 {TEX_OGONEK, "\\k", /*" AaEe",*/ "ogonek", LFUN_ACCENT_OGONEK},
73 { static_cast<tex_accent>(0), "", /*"",*/ "", static_cast<kb_action>(0)}};
76 tex_accent_struct get_accent(kb_action action)
79 while (i <= TEX_MAX_ACCENT) {
80 if (lyx_accent_table[i].action == action)
81 return lyx_accent_table[i];
84 struct tex_accent_struct temp = { static_cast<tex_accent>(0), 0,
85 0, static_cast<kb_action>(0)};
90 string const DoAccent(string const & s, tex_accent accent)
94 res += lyx_accent_table[accent].cmd;
96 if (s == "i" || s == "j") {
105 string const DoAccent(char c, tex_accent accent)
107 return DoAccent(convert<string>(c), accent);