I have added many font-family and style into my asset folder in React-Native project. It's working fine in simulator, emulator, and iOS device. But some font won't work and not display in Android device.
I have try with react-native link and check the asset folder in Android app directory, nothing missing.
Anyone help please.
I might have a solution for this. I had the same problem, the fonts were visible in my emulator, the font files are located under 'android/src/main/assets/fonts' and yet it wasn't visible on my physical android device (Huawei Honor 8X).
I found out that the problem was with my physical device's Font settings. To fix this, on your phone, go to
Settings -> Display -> Text Style -> Default
Settings screen : Go to Display
Display settings : Look for Text Style, Make sure it is set to default as seen in the pic
Select Default here : Now your custom app fonts should work
Please Note that these settings might differ as per your device. I've mentioned the steps for my phone.
Always use the default Text Style to render custom fonts in your app.
Nowadays, phones like the OnePlus etc. have their own custom fonts and I think this is interfering with custom fonts defined in Applications.
Hope this helps.
Following this article worked for me. The name of the font file name is important to get it working on both platforms.
I had multiple font files with different weights (Circular Std Bold, Circular Std Medium etc..) for these to work on android I dynamically changed the font family style to this name to change the weight.
The font weight style on android didn't work for me.
the problem is with devices that have custom font style like huawei devices. I hope there be a solution for this to not force the user to change it's device font style because of our app.
My font family changes when I connect to my android device but I finally figured out how to fix it. If font weight is set then it changes the font on my device to its default font. After I removed font weight my android devices default font isn't applied anymore.
fontFamily its not work in inlinstyle you must change from
<Text style={{fontFamily:'SantPro'}} />
to
Text style={styles.text}
const styles = StyleSheet.create({
text: {
fontFamily:'SantPro',
},
})
Related
I'm building a react native app, and I've linked my fonts to my projects. For iOS, i'm having trouble with the font variations. I am using the Roboto font family, and no matter what font weight variation I use, it shows up as "Roboto-Regular".
If I do:
fontFamily: 'Roboto-Medium' or
fontFamily: 'Roboto-Bold'
It displays the same as Roboto-Regular. I am not having this issue in Android. The fonts folder is added to the Bundle Resources, and to the info.plist.
Just to test things out further if i do:
fontFamily: 'Roboto-sMedium' it will show a warning message "Unrecognized fontFamily", and revert to a system default font.
There is no problem in xcode recognizing the font family, but I cannot get the Medium and Bold variations to show properly.
Any suggestions?
--edit--
I figured out this was an issue with the Native Base elements I am using, where the style attributes were not recognizing the font weight variations on any Native Base elements.
For example, the <Text> element from Native Base didn't recognize the font weight variation of style={{fontFamily: 'Roboto-Medium'}}
If I switched to the react native <Text> element it would work appropriately.
I realize that you need to customize the them in Native Base to use the font properties as noted here:
https://docs.nativebase.io/customizing-fonts
However, I did not expect that the font-family style attributes would not work.
This might be a simple question, but how to add an icon to a screensaver in XCode ?
I'd added a Assets.xcassets to my project, an AppIcon with all versions possible of the image, but it is still shown with the default icon :(
Any hints of what i am doing wrong or missing ?
First ensure your General settings are correct:
In order for xcode to know where to pull the App Icon Source you should set this according to the name you assigned to the Icon Set. By default it pulls from AppIcon within your Assets folder. (As seen in the image below)
Also check all icons for correct dimensions:
If your general settings are correct and you are pulling from the correct icon source. Then the issue may have to do with a one or multiple icon sizes in your Assets folder that are not the correct dimensions. If you are missing icons or have incorrect dimensions the icon will not show up.
Hope this helps.
Finally got it working.
Applying AppIcons to a secreensaver is not enough.
You need to add two png images to the project too:
thumbnail.png – 90 x 58 pixels
thumbnail#2x.png – 180 x 116 pixels
The rest is done automaticly.
Hope this helps, if someone runs into the same problem.
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 want to use icons like opened/closed folder in my table (UITableView)?
UPD:
For example, in Java you can get a standard image "folder" and use it in the FileTree:
new
DefaultTreeCellRenderer().getDefaultClosedIcon()
And also can use the constants of L&F (colors, styles, icons).
In the iOS, I found only these standard icons.
But not folder icons...
I'm not quite sure exactly what you want - the folder icon from iOS? Could you explain a little better?
If it is a folder icon that you want, there's no quick way to get it from code - doing so would use private API's and your app is likely to be rejected from the app store.
If you want something like a folder icon, a good way to get it would be by taking a screenshot of the iPhone simulator and editing it to the right size etc.
What is the best way to skin/theme an AIR application. For example, I want to use a dark/blackish theme instead (similar to Tour de Flex) instead of the default gray one.
The ScaleNine themes are a good place to start, find one that is sort of like what you want, plug it into your app, and gradually replace the colors, images, and controls with your own.
http://www.scalenine.com/
I'm only just getting started in AIR as well, but if you're using Flex check out the Flex in a Week video series. There are several videos that cover creating custom MXML components and item renderers, which effectively let you skin your application.
You can also use CSS to style your app.
First you need to set the system chrome property in the air application properties file to none.
<initialWindow>
...
<systemChrome>none</systemChrome>
...
</initialWindow>
If the main file in your air app is named Main.mxml, then your application properties files will be named Main-app.xml. This file is not hard to find, it should be in the same location as the Main.mxml file.
By setting this property to none you are saying that you do not wish your air app window to take the style of the OS windows in which the app is running.
Since this property is set to none, the chrome for the air app will have to come from your Main.mxml file, which should be a WindowedApplication
Use the titleBarBackgroundSkin attriubute of the WindowedApplication To set the skin for the air app. titleBarBackgroundSkin defaults to "mx.skins.halo.ApplicationTitleBarBackgroundSkin"