diff -Naur terminal.orig/AppearPrefView.cpp terminal/AppearPrefView.cpp
old
|
new
|
|
19 | 19 | #include <PopUpMenu.h> |
20 | 20 | |
21 | 21 | #include <stdlib.h> |
| 22 | #include <stdio.h> |
22 | 23 | |
23 | 24 | |
24 | 25 | AppearancePrefView::AppearancePrefView(BRect frame, const char *name, |
… |
… |
|
170 | 171 | if (get_font_family(i, &family, &flags) == B_OK) { |
171 | 172 | BFont font; |
172 | 173 | font.SetFamilyAndStyle(family, NULL); |
173 | | if (font.IsFixed()) { |
| 174 | //TODO: checkout this method fit for all fonts |
| 175 | int32 width_ok = 1; |
| 176 | int lastWidth, tmpWidth; |
| 177 | for (int c = 0x20 ; c <= 0x7e; c++){ |
| 178 | char buf[4]; |
| 179 | sprintf(buf, "%c", c); |
| 180 | tmpWidth = (int)font.StringWidth(buf); |
| 181 | if (c > 0x20 &&(tmpWidth != lastWidth)) |
| 182 | width_ok = 0; |
| 183 | lastWidth = tmpWidth; |
| 184 | } |
| 185 | if (width_ok){ |
174 | 186 | BMenuItem *item = new BMenuItem(family, new BMessage(command)); |
175 | 187 | menu->AddItem(item); |
176 | 188 | if (!strcmp(defaultFontName, family)) |
diff -Naur terminal.orig/BasicTerminalBuffer.cpp terminal/BasicTerminalBuffer.cpp
old
|
new
|
|
537 | 537 | |
538 | 538 | |
539 | 539 | void |
540 | | BasicTerminalBuffer::InsertChar(UTF8Char c, uint32 attributes) |
| 540 | BasicTerminalBuffer::InsertChar(UTF8Char c, uint32 width, uint32 attributes) |
541 | 541 | { |
542 | 542 | //debug_printf("BasicTerminalBuffer::InsertChar('%.*s' (%d), %#lx)\n", |
543 | 543 | //(int)c.ByteCount(), c.bytes, c.bytes[0], attributes); |
544 | | int width = CodeConv::UTF8GetFontWidth(c.bytes); |
| 544 | |
| 545 | //int width = CodeConv::UTF8GetFontWidth(c.bytes); |
| 546 | |
545 | 547 | if (width == FULL_WIDTH) |
546 | 548 | attributes |= A_WIDTH; |
547 | 549 | |
diff -Naur terminal.orig/BasicTerminalBuffer.h terminal/BasicTerminalBuffer.h
old
|
new
|
|
96 | 96 | TermPos& matchEnd) const; |
97 | 97 | |
98 | 98 | // insert chars/lines |
99 | | void InsertChar(UTF8Char c, uint32 attributes); |
100 | | inline void InsertChar(const char* c, int32 length, |
101 | | uint32 attributes); |
| 99 | inline void InsertChar(UTF8Char c, uint32 attributes); |
| 100 | void InsertChar(UTF8Char c, uint32 width, uint32 attributes); |
| 101 | inline void InsertChar(const char* c, int32 length, uint32 attributes); |
| 102 | inline void InsertChar(const char* c, int32 length, uint32 width, uint32 attributes); |
102 | 103 | void InsertCR(); |
103 | 104 | void InsertLF(); |
104 | 105 | void SetInsertMode(int flag); |
… |
… |
|
208 | 209 | return fHistory != NULL ? fHistory->Capacity() : 0; |
209 | 210 | } |
210 | 211 | |
| 212 | void |
| 213 | BasicTerminalBuffer::InsertChar(UTF8Char c, uint32 attributes) |
| 214 | { |
| 215 | return InsertChar(c, 1, attributes); |
| 216 | } |
211 | 217 | |
212 | 218 | void |
213 | 219 | BasicTerminalBuffer::InsertChar(const char* c, int32 length, uint32 attributes) |
214 | 220 | { |
215 | | return InsertChar(UTF8Char(c, length), attributes); |
| 221 | return InsertChar(UTF8Char(c, length), 1, attributes); |
216 | 222 | } |
217 | 223 | |
| 224 | void |
| 225 | BasicTerminalBuffer::InsertChar(const char* c, int32 length, uint32 width, uint32 attributes) |
| 226 | { |
| 227 | return InsertChar(UTF8Char(c, length), width, attributes); |
| 228 | } |
218 | 229 | |
219 | 230 | void |
220 | 231 | BasicTerminalBuffer::SetCursorX(int32 x) |
diff -Naur terminal.orig/Coding.cpp terminal/Coding.cpp
old
|
new
|
|
31 | 31 | {"EUC-jp", "EUCJ", 'E', B_EUC_CONVERSION}, |
32 | 32 | {"EUC-kr", "EUCK", 'K', B_EUC_KR_CONVERSION}, |
33 | 33 | |
| 34 | {"GB18030", "GB18030", 'G', B_GBK_CONVERSION}, |
| 35 | {"Big5", "Big5", 'B', B_BIG5_CONVERSION}, |
34 | 36 | |
35 | 37 | /* Not Implemented. |
36 | 38 | {"EUC-tw", "EUCT", "T", M_EUC_TW}, |
diff -Naur terminal.orig/TermParse.cpp terminal/TermParse.cpp
old
|
new
|
|
326 | 326 | int *groundtable = gUTF8GroundTable; |
327 | 327 | int *parsestate = groundtable; |
328 | 328 | |
| 329 | int width = 1; |
329 | 330 | BAutolock locker(fBuffer); |
330 | 331 | |
331 | 332 | while (!fQuitting) { |
… |
… |
|
358 | 359 | case B_EUC_CONVERSION: |
359 | 360 | case B_EUC_KR_CONVERSION: |
360 | 361 | case B_JIS_CONVERSION: |
| 362 | case B_GBK_CONVERSION: |
| 363 | case B_BIG5_CONVERSION: |
361 | 364 | groundtable = gISO8859GroundTable; |
362 | 365 | break; |
363 | 366 | case M_UTF8: |
… |
… |
|
379 | 382 | /* case iso8859 gr character, or euc */ |
380 | 383 | ptr = cbuf; |
381 | 384 | if (now_coding == B_EUC_CONVERSION || now_coding == B_EUC_KR_CONVERSION |
382 | | || now_coding == B_JIS_CONVERSION) { |
| 385 | || now_coding == B_JIS_CONVERSION || now_coding == B_GBK_CONVERSION |
| 386 | || now_coding == B_BIG5_CONVERSION) { |
383 | 387 | switch (parsestate[curess]) { |
384 | 388 | case CASE_SS2: /* JIS X 0201 */ |
| 389 | width = 1; |
385 | 390 | *ptr++ = curess; |
386 | 391 | *ptr++ = c; |
387 | 392 | *ptr = 0; |
… |
… |
|
389 | 394 | break; |
390 | 395 | |
391 | 396 | case CASE_SS3: /* JIS X 0212 */ |
| 397 | width = 2; |
392 | 398 | *ptr++ = curess; |
393 | 399 | *ptr++ = c; |
394 | 400 | _NextParseChar(c); |
… |
… |
|
398 | 404 | break; |
399 | 405 | |
400 | 406 | default: /* JIS X 0208 */ |
| 407 | width = 2; |
401 | 408 | *ptr++ = c; |
402 | 409 | _NextParseChar(c); |
403 | 410 | *ptr++ = c; |
… |
… |
|
406 | 413 | } |
407 | 414 | } else { |
408 | 415 | /* ISO-8859-1...10 and MacRoman */ |
| 416 | width = 1; |
409 | 417 | *ptr++ = c; |
410 | 418 | *ptr = 0; |
411 | 419 | } |
… |
… |
|
417 | 425 | B_EUC_CONVERSION); |
418 | 426 | } |
419 | 427 | |
420 | | fBuffer->InsertChar(dstbuf, 4, attr); |
| 428 | fBuffer->InsertChar(dstbuf, 4, width, attr); |
421 | 429 | break; |
422 | 430 | |
423 | 431 | case CASE_PRINT_CS96: |
diff -Naur terminal.orig/TermView.cpp terminal/TermView.cpp
old
|
new
|
|
1056 | 1056 | i = lastColumn + 1; |
1057 | 1057 | continue; |
1058 | 1058 | } |
| 1059 | |
| 1060 | if (IS_WIDTH(attr)) |
| 1061 | count = 2; |
| 1062 | else |
| 1063 | count = 1; |
1059 | 1064 | |
1060 | 1065 | _DrawLinePart(fFontWidth * i, (int32)_LineOffset(j), |
1061 | 1066 | attr, buf, count, insideSelection, false, this); |