From 4e6c2aadd7d652db3ba1f35eef1a3d61d6e692d0 Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Wed, 3 Jul 2013 23:06:43 +0200
Subject: Revise commit 4c34f5980bddcdc84b10cb3bcbb96b365b9d471e (Bug 767):
 TAB, BS and CR/ENTER are printable for NEWT KeyEvent and font handling. Fix
 regression.

- Original behavior was treating CR/ENTER them as printable, lets keep it this way.
- KeyEvent: Query these 3 whitespaces upfront, no need to incl. them in 'nonPrintableKeys'.

- Fix regression: Native VK_ENTER was not change in commit 4c34f5980bddcdc84b10cb3bcbb96b365b9d471e.
---
 src/jogl/classes/com/jogamp/graph/font/FontFactory.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'src/jogl/classes/com/jogamp/graph/font')

diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
index bbdfc0e9f..d2824b9dc 100644
--- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
+++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java
@@ -93,10 +93,13 @@ public class FontFactory {
     }    
     
     public static boolean isPrintableChar( char c ) {
-        Character.UnicodeBlock block = Character.UnicodeBlock.of( c );
-        return (!Character.isISOControl(c)) &&
-                c != 0 &&
-                block != null &&
-                block != Character.UnicodeBlock.SPECIALS;
+        if( Character.isWhitespace(c) ) {
+            return true;
+        }
+        if( 0 == c || Character.isISOControl(c) ) {
+            return false;
+        }
+        final Character.UnicodeBlock block = Character.UnicodeBlock.of( c );
+        return block != null && block != Character.UnicodeBlock.SPECIALS;
     }    
 }
-- 
cgit v1.2.3