There is an issue with English text in TextView and WebView when using Arabic or Persian typeface, The following image is an example of Persian and English text in both TextView (2 views in the header) and WebView (at the bottom) when using default typeface : Shot 1
But when applying a custom typeface it looks like this (Iran Sans Serif is applied here but almost all Persian fonts have the same issue) : Shot 2
As you can see, in TextView with Persian typeface, English texts are not aligned correctly and in WebView there is extra padding between some lines due to difference between Persian texts size and English texts size.
Be sure that there is no problem with the fonts because in Websites, they're working like a charm!
Related
I have HTML text as that
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<p>I am normal</p>
<p><b>This text is bold</b></p>
<p><i>This text is italic</i></p>
<p>This is<sub> subscript</sub> and <sup>superscript</sup></p>
and it should appear like that
This is a heading
This is a paragraph.
I am normal
This text is bold
This text is italic
This is subscript and superscript
How can I split the whole text into screens Based on screen width and height and with the HTML style?
I tried this answer
How to break styled text into pages in Android?
but the HTML style not saved
Is there any library or code can do this?
Full HTML can be rendered just in WebViews, to have screen-related text dimensions you can use a custom styled TextView nested in a layout like RelativeLayout, referencing views width and height in dimens.xml (so you can adopt different paddings and dimensions for small and large devices)
I am using arabic font in my android app but the numbers is written in arabic , I want to use the same font but numbers still in English Language,Or Customize the TypeFace..Any way??
I'm including the Roboto family of fonts in my application, and create the fonts in code like so:
Typeface robotoLight = Typeface.createFromAsset(getAssets(), "fonts/Roboto-Light.ttf");
I have noticed that certain smaller sizes (even the suggested sizes from the Android Developer Typography page) appear distorted or pixelated. Here is a screenshot of a few TextViews in the app:
"Upcoming Dates" uses a larger size and looks fine. The other ones are sized at 14sp and look awful. The problem is not with margin or padding in the TextViews -- I've tried altering both. Does anyone know what causes this problem, and how to fix it?
Try the following on each of your TextViews with the custom typeface:
int flags = textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG
| Paint.ANTI_ALIAS_FLAG;
textView.setPaintFlags(flags);
My app uses both TextViews and WebViews. In both I set the size of text in pt. The problem is that the text in WebView is usually half the size as the text in TextView. I have tested on multiple screen sizes and desnsities but it makes no difference.
I set TextView height using:
textView.setTextSize( TypedValue.COMPLEX_UNIT_PT, 14 );
But in WebView I use CSS:
font: 14pt;
Both work, but it seems like TextView's display is bigger than WebView's. Any clue what is going on? I want to display the text in TextView as the same size as in my WebView.
I have trouble with my font.
I need to display plain, bold and italic text in a specific font in the same textView.
I use html.fromHtml and with the regular android font it works fine.
I want helvetica instead, so I built a single font file witch contained the three fonts (plain bold italic), and used setTypeFace on my textView. I built it from 3 otf files with fontBuilder.
But when I call Typeface.createFromAsset(getAssets(), "fonts/HelveticaNeue.dfont");
i saw that my font file size was 0 bytes, and indeed in my project I can't import it well,
when i go in the folder fonts i see that the size is ok, but from eclipse point of view, 0 bytes.
Does somebody have an idea ?
ANSWER:
The problem was that my font didn't had dataFork, it's a thing that you have to add to your font for it to be understood by PC's, and Unix OS.
is it correct format .dfont
i think fonts should be with .ttf
Typeface.createFromAsset(getAssets(), "fonts/HelveticaNeue.ttf")