I have the following international text in my react native app:
<Text>ᚘᚘᚘ</Text>
However, a blank line is displayed to my screen where the text should go. I have tried for other international characters as well and it is the same result.
I am using notepad++ and making sure that encoding is set to UTF-8. If I use console.log("ᚘᚘᚘ") it displays to the console just fine. Do I specifically need to embed a particular unicode font in my React Native project for it to work correctly? Or what should I be doing so that it displays my text correctly?
On further investigation I am using a Samsung Galaxy S2 for testing purposes. It does not seem to handle unicode characters in all applications, so I think my app will not work in older devices unless I specifically embed a Unicode font. Am I correct in my thinking?
The only solution I found to this was to add a custom font. This link explains how to use a custom font: https://blog.bam.tech/developper-news/add-a-custom-font-to-your-react-native-app . The font I used is called GNU FreeFont located here: https://www.gnu.org/software/freefont/
Related
I am working on an e-library project, where we have to display pdf books for children.
I would like to know if I can find some PDF plugins to display PDF nicely.
I used to have the same problem and I figured out, that Android works very well with rn-pdf-reader-js. On the other hand, for ios WebView component is 100% sufficient to display PDF content, so I switched (depends on the platform) between the two of them.
I'm developing a UWP app for tablet and i need to generate a PDF with data from SQLite. I need to do this completely offline because where I will use the app there is no connection. What could I do?
I'd prefer not to use paid libraries like Syncfusion and XFinium so I'm trying to find an alternative solution.
I tried with iTextSharp but unfortunately I can't find a good documentation to render a complex PDF or to export a Bitmap generated from a Grid Component to a PDF File.
Why not render your data into a webpage displayed with a WebView control? Then you can use any permissive licensed javascript library to generate the PDF.
If it hasn't changed much, then you can only send text back and forth between your WebView and UWP app, but that's workable. Your final PDF result can be read back as a base64 encoded string.
A very quick search found this one that seems easy to use and you can just download the source to put into your app:
https://github.com/MrRio/jsPDF
I have made an app which has several custom fonts, but i'm struggling to make it work on ios6 devices, i have added them in myApp-Info.plist and it works without any problem on labels and buttons and everywhere except uiwebviews in ios7 , but in ios 6 it looks like the default font in everywhere and there is no change throughout the whole app in fonts. After searching couple of weeks, still haven't find any answer that would work.
Here is my code for assigning a font to label :
titleLable.font=[UIFont fontWithName:#"B Yekan" size:17];
I just encountered this problem, also, and found that in iOS 7, font names aren't case-sensitive; i.e., I was trying to use "ChunkFive-Roman", which worked in iOS 7 even though my code said "Chunkfive-Roman".
However, this doesn't work in iOS 6... I was getting the default font instead. Changing the font name to "ChunkFive-Roman" fixed it so that that the text was appearing correctly in both. (Note -- was using Simulator in both cases).
You have to follow the rules in this link, once you do it there u go..
Add your custom font into your project , i.e. Dragged the font's ttf file (CALIBRIZ_0.TTF) into your resource folder from finder and check the "copy file to project folder" option. )
Edit Info.plist: Add a new entry with the key Fonts provided by application.
For each of your files, add the file name to this array (Fonts provided by application)
Now set font to your label:
MyLabel.font = [UIFont fontWithName:#"Calibri" size:16];
http://blog.builtwithlogic.com/post/73503283890/installing-custom-fonts-on-iphone-and-ipad-ios-devices
Covers how to add fonts - Little confused though by your question you specifically mention iOS6 as the problem and UIWebView - Be interested to know what you mean by that piece?
Have you tried setting the fonts using UIAppearance ? or are you subclassing and amending the fonts as it could be that you've not done it right there. Could you supply some code showing how you setting you custom fonts throughout the app?
If you haven't already I'd ensure you've followed the steps in that email and then add a custom category to UIFont to pass back a specific font. If you haven't already done so I would also set the fonts in UIAppearance for your labels, Titles etc this is the cleanest and most efficient way to do it throughout your application as you only need set it one and you can set differently based on how a for example Label is presented -in a tableview in a navigation bar etc.
here's a link to the official docs
https://developer.apple.com/library/ios/documentation/uikit/reference/UIAppearance_Protocol/Reference/Reference.html
Appreciate this question is old but love to know if that helps.
I had a similar problem where the custom font would work in iOS7, but not iOS6.
The solution for me was to use the true font name not the filename.
To do this check the font name as shown in OSX's FontBook.
iOS7 allowed me to use the the filename (less the .ttf suffix), but iOS6 wanted the true font name as shown in FontBook.
For example for a font named CustomFont.ttf .....
I followed all the steps listed by others here to add the font to my app, but then used it by referencing it as #"CustomFont".
When I added the font to my mac and looked at it in FontBook (mac utility), it was actually named #"Custom font" - with a space and a lower case letter.
Hopefully this helps someone else out there :-)
iOS 6 cannot do custom fonts. That is a new feature only available in iOS 7.
I'm parsing an XML file an get a string as NSMutableString.
Now I want to show this string as text in my UIView.
So, I created a TextView and set its value to my string. The result was that I have the text with HTML Tags shown up in the TextView.
There is no problem removing the tags from the string, but some of the text needs to appear as bold.
Is there any way to display parts of a string as bold programmatically?
I replaced <br> Elements with \n and it works fine for line-break.
But I still don't know what I can do to display words between strong tags as bold in the UIView.
There are two ways. The first is by displaying them in UIWebViews; prior to iOS 4.1 this was effectively the only way. Because you already have HTML codes in the text, it would certainly be easy.
If you're ok with your app running only on iOS 4.1 and up you can use Core Text, which provides very rich formatting.
EDIT
Apple provides some good resources:
About Text, Web, and Editing Support in iOS
Core Text Programming Guide
WWDC 2010 Session Videos -- follow the link to iTunes and grab session 110: Advanced Text Handling for iPhone OS
(Apple Developer login required)
You may use UIWebView and load your content from an NSString object.
Anyway if you want to stick to Cocoa, have a look to NSAttributedString.
I am working on the PDF App for iPad and facing an issue: how to search a text in PDF and also how to highlight that text?
Yours is the same big problem I'm having. My understanding is that, currently on iOS 4.0, the main public API is CGPDF . It allows us to parse PDF, and with it we can search strings in it. See also this Quartz 2D document. It also allows us to render it on the screen using CGContextDrawPage. However, it's not yet possible to get the position of a text in the rendered image. (On OS X it's possible using PDFKit.)
So, I'm afraid that you need to implement the PDF spec yourself to get that info. I think GoodReader etc. is working very very hard to implement these.
I had the same trouble recently and then I found FastPDFKit. Have tested the package and it's working great.
http://mobfarm.eu/fastpdfkit