how to overcome font problem in blackberry? - unicode

I am reading data from a .csv file and displaying it. When I encounter the micro character (µ) some special symbols are displayed instead. How can I display the micro character?

class Scr extends MainScreen
{
public Scr() {
LabelField label = new LabelField();
String fontName = label.getFont().getFontFamily().getName();
String text = "Font name: "+fontName+" Symbol: µ";
label.setText(text);
add(label);
}
}
screen http://img207.imageshack.us/img207/9606/screenwx.jpg
Can't reproduce on RIM OS 4.5 Curve 8300, font "BBAlpha Sans".
Check what font are you using, there may be no "µ" symbol
Try to debug and see if symbol is readed correctly from file

Related

Flutter how to detect Line feed (LF)

how can i detect line feed in Flutter?
as I know CR can be detected by "\n" and it's working fine.
this is the code I used for CR
if (value.toString().contains("\n")) {
fetchProducts(value);
} else {}
},
I tried "\r" but its not working.
I am Using TextFormFiled and the setting in the device was set to send LF after reading a barcode
You can use the unicode value for LF, U+000A:
if (value.toString().contains("\u{000a}")) {
fetchProducts(value);
} else {}
},
EDIT
What is the type of value? In my code, to be sure that I'm converting correctly from bytes to String, instead of using toString I'm using this:
import 'dart:convert' show utf8;
[...]
String message = utf8.decode(data);

Flutter/Dart programmatically unicode string

I have a list of customized icons to my app, it comes like below setted as IconData, note codePoint (0xe931).
IconData angry_face = IconData(0xe931, fontFamily: _fontFamily);
There's nothing wrong with that, but I've some cases where I need this icon as Unicode string to be used as a text. It should be done just like:
// It works too
Text('\ue931', style: TextStyle(fontFamily: _fontFamily));
The problem is:
I don't wanna use this code "by hand" because this icons are changed constantly by designers team and sometimes it changes its code messing up my app icons. What I need to do is get the icon object and parse it to the Unicode string, so I can use it with a Text widget.
I thought that would work to get programmatically that code and just use it, but it don't:
var iconcode = iconData.codePoint.toRadixString(16);
var result;
// Error: An escape sequence starting with '\u'
// must be followed by 4 hexadecimal digits or
// from 1 to 6 digits between '{' and '}'
result = '\u$iconcode';
// Just a simple string
result = '\\u$iconcode';
In few words: How can I parse programmatically int codePoint to a valid Unicode string?
Here's the right answer. I tried everything but this... Thank you #julemand101
final result = String.fromCharCode(iconData.codePoint);

Eclipse editor plugin - line numbers and print margin

I write editor as plugin to eclipse. I write it as extends TextEditor. And I need show line numbers and print margin. I cant find method where to set. Where can I set it? Maybe I extends wrong class.
Edit:
I fixed it like that:
public void setFocus() {
getPreferenceStore().setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, true);
getPreferenceStore().setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, true);
getPreferenceStore().setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 72);
super.setFocus();
}

Choosing a FontProviderImp in iTextSharp

I am using XMLWorker for parsing html. I have been having some issues with the fonts I define in the styles. For example, something simple as this:
<span style="font-family: Garamond">Foo Garamond</span>
wasn't not working.
I was using this as my css applier:
CssAppliers ca = new CssAppliersImpl();
In order to check if it was a problem with the encoding of the html, or any other issue..., I did my own implementation of the IFontProvider:
class MyFontProvider : IFontProvider
{
public bool IsRegistered(string fontname)
{
return false;
}
public Font GetFont(string fontname, string encoding, bool embedded, float size, int style, BaseColor color)
{
var font = FontFactory.GetFont(fontname, encoding, embedded, size, style, color);
return new Font(font);
}
}
Then, this:
CssAppliers ca = new CssAppliersImpl(new MyFontProvider());
Great!!!, that works fine!!!, also if I passed to the constructor this:
CssAppliers ca = new CssAppliersImpl(new XMLWorkerFontProvider());
also works.
So, it is obvious that the default implementation of the font provider is not working. I defined it as this:
CssAppliers ca = new CssAppliersImpl();
or
CssAppliers ca = new CssAppliersImpl(new FontFactoryImp());
, and neither worked.
My questions are:
What possible explanation has this?
Differences between XMLWorkerFontProvider and FontFactoryImp implementations
FontFactoryImp is part of iText/iTextSharp core. It provides access to the required core 14 fonts and allows you to optionally register additional font files and give them nice names. But unless you manually register a font file it will just return the "default" font.
XMLWorkerFontProvider is part of XMLWorker and is actually a subclass of FontFactoryImp. The biggest difference between the two is that if you use the empty constructor on XMLWorkerFontProvider it actually calls base.RegisterDirectories() which registeres every font in the system font folder. Depending on the number of fonts you have this could be expensive which is why the default version doesn't do it.

3DText - Change Text Through Script - Unity

I have read lot of questions on how to change text of a 3DText from script.
Lot of them suggested the following :::
GetComponent(TextMesh).text = "blah";
But when I try to use this, I get an error Expression denotes atype', where a variable',value' or method group' was expected
I tried a lot of examples and couldn't really get it to work.
TextMesh textMesh;
textMesh = (TextMesh) descriptionObject.transform.GetComponent("Text Mesh");
textMesh.text = "Name : ABC";
The above code though Compiles without errors doesn't change the text. Can someone help me out with this? How do I change the TEXT of a 3DText Object.
Thanks...
This would be a prettier solution than one already given(C# script used in example) :
//define a Textmesh that we want to edit
public TextMesh tm;
// here in start method (run at instantiating of script) i find component of type
// TextMesh ( <TextMesh> ) of object named"nameOfTheObject" and reference it
// via tm variable;
void Start () {
tm = (TextMesh)GameObject.Find ("nameOfTheObject").GetComponent<TextMesh>();
// here we change the value of displayed text
tm.text = "new Text u want to see";
}
Or if u want to do it the shortest way possible (syntax wise):
//keep in mind this requires for the script to be attached to the object u
// are editing (the 3dText);
//same as above, the only difference is the note in the line above as this
// method is run from gameObject.GetComponent....
// gameObject is a variable which would be equivalent of this.GetComp...
// in some other programming languages
GetComponent<TextMesh>().text ="new Text u want";
This Works !!!!
textMesh = (TextMesh) descriptionObject.transform.GetComponent(typeof(TextMesh));
textMesh.text = "Name : ABC";