Commit 8b88ea8d8365025c6603bf37453748970084f26a
1 parent
e42f96cc
Exists in
master
and in
1 other branch
Fixing CG char 0x00.
Showing
1 changed file
with
22 additions
and
19 deletions
Show diff stats
src/terminal/drawing/draw.c
| ... | ... | @@ -257,24 +257,12 @@ static void draw_small_text(cairo_t *cr, const GdkRectangle *rect, v3270FontInfo |
| 257 | 257 | |
| 258 | 258 | static gboolean draw_cg(cairo_t *cr, unsigned char chr, v3270FontInfo *font, GdkRectangle *rect) |
| 259 | 259 | { |
| 260 | - // https://unicode.org/charts/PDF/U2300.pdf | |
| 261 | - static const struct CharList | |
| 262 | - { | |
| 263 | - unsigned char chr; | |
| 264 | - const gchar * utf; | |
| 265 | - } charlist[] = | |
| 266 | - { | |
| 267 | - { 0x8c, "≤" }, // CG 0xf7, less or equal "≤" | |
| 268 | - { 0xae, "≥" }, // CG 0xd9, greater or equal "≥" | |
| 269 | - { 0xbe, "≠" }, // CG 0x3e, not equal "≠" | |
| 270 | - { 0xad, "[" }, // "[" | |
| 271 | - { 0xbd, "]" }, // "]" | |
| 272 | - { 0xb8, "÷" }, // Division Sign ÷ | |
| 273 | - | |
| 274 | - }; | |
| 275 | - | |
| 276 | 260 | size_t ix; |
| 277 | 261 | |
| 262 | + // 0x00 is always blank. | |
| 263 | + if(!chr) | |
| 264 | + return TRUE; | |
| 265 | + | |
| 278 | 266 | if(chr >= 0xf0 && chr <= 0xf9) |
| 279 | 267 | { |
| 280 | 268 | char str[] = { '0' + (chr-0xF0), 0 }; |
| ... | ... | @@ -289,6 +277,23 @@ static gboolean draw_cg(cairo_t *cr, unsigned char chr, v3270FontInfo *font, Gdk |
| 289 | 277 | return TRUE; |
| 290 | 278 | } |
| 291 | 279 | |
| 280 | + // Check for UTF-8 CG - https://unicode.org/charts/PDF/U2300.pdf | |
| 281 | + static const struct CharList | |
| 282 | + { | |
| 283 | + unsigned char chr; | |
| 284 | + const gchar * utf; | |
| 285 | + } charlist[] = | |
| 286 | + { | |
| 287 | + { 0x8c, "≤" }, // CG 0xf7, less or equal "≤" | |
| 288 | + { 0xae, "≥" }, // CG 0xd9, greater or equal "≥" | |
| 289 | + { 0xbe, "≠" }, // CG 0xbe, not equal "≠" | |
| 290 | + { 0xad, "[" }, // "[" | |
| 291 | + { 0xbd, "]" }, // "]" | |
| 292 | + { 0xb8, "÷" }, // Division Sign ÷ | |
| 293 | + { 0x90, "⎕" }, // APL FUNCTIONAL SYMBOL QUAD | |
| 294 | + }; | |
| 295 | + | |
| 296 | + | |
| 292 | 297 | for(ix = 0; ix < G_N_ELEMENTS(charlist); ix++) |
| 293 | 298 | { |
| 294 | 299 | if(chr == charlist[ix].chr) |
| ... | ... | @@ -333,6 +338,7 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 |
| 333 | 338 | else if(attr & LIB3270_ATTR_CG) |
| 334 | 339 | { |
| 335 | 340 | |
| 341 | + //http://www.prycroft6.com.au/misc/3270eds.html | |
| 336 | 342 | switch(chr) |
| 337 | 343 | { |
| 338 | 344 | case 0xd3: // CG 0xab, plus |
| ... | ... | @@ -407,10 +413,7 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 |
| 407 | 413 | default: |
| 408 | 414 | |
| 409 | 415 | if(!draw_cg(cr, chr, font, rect)) |
| 410 | - { | |
| 411 | 416 | lib3270_write_screen_trace(session,"I don't known how to draw CG character %02x\n",(int) chr); |
| 412 | - cairo_rectangle(cr, rect->x+1, rect->y+1, rect->width-2, rect->height-2); | |
| 413 | - } | |
| 414 | 417 | |
| 415 | 418 | } |
| 416 | 419 | } | ... | ... |