I've added some custom fonts to the project:
The fonts are added to the target, are included in the "Copy Bundle Resources" list, and are also added to Info.plist under Fonts Provided by Application.
However, those fonts don't show correctly in the Interface Builder. It shows the font family (CentraleSans), but gives me only 2 font choices for that family.
Moreover, the actual font IB ends up using seems random (the final selection can be CentraleSansBold or CentraleSansBook, or other ones, for the same family/font values I pick). Notice how in the screenshot above it says "CentraleSansBook", even though that was not an option in the drop down list. Is this an IB bug?
OK, I found a way to make it work. I had to install the custom fonts on my Mac. Double-click on the font file in Finder, then click "Install Font". After that the font will appear in the drop down list in IB.
Related
I'm just starting to look at IOS Apps' localization in XCode 5 and I've tried to add an Italian Localization:
Xcode 5 automatically generates the Main.strings file with a single entry, for the only label I've put within the Main.storyboard file:
/* Class = "IBUILabel"; text = "Label"; ObjectID = "PeT-4z-NSf"; */
"PeT-4z-NSf.text" = "Etichetta";
If I later modify the Main.storyboard file adding a new button to the view, then how should I tell Xcode 5, if possible, to add missing localization strings to the Main.strings file? Should I add a new entry by hand by looking at the Object ID field in Interface Builder (it works, but I don't know if this is how it is meant to update storyboards' localization)? Can I run something like genstrings on the Main.storyboard file to extract all the labels' text and add the new ones to the localized Main.strings files?
Check out ReMafoX, it's a Mac app that perfectly solves your problem. It can be easily installed and integrated within your project, watch this video for a detailed walkthrough.
Alternatively, if you prefer an open-source CLI tool without a GUI, you can also use BartyCrouch.
Install BartyCrouch via Homebrew:
brew install bartycrouch
Alternatively, install it via Mint:
mint install Flinesoft/BartyCrouch
Incrementally update your Storyboards/XIBs Strings files:
$ bartycrouch update
This will do exactly what you were looking for.
In order to keep your Storyboards/XIBs Strings files updated over time I highly recommend adding a build script (instructions on how to add a build script here):
if which bartycrouch > /dev/null; then
bartycrouch update -x
bartycrouch lint -x
else
echo "warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch"
fi
In addition to incrementally updating your Storyboards/XIBs Strings files this will also make sure your Localizable.strings files stay updated with newly added keys in code using NSLocalizedString and show warnings for duplicate keys or empty values.
Make sure to checkout BartyCrouch on GitHub for additional information.
The file that Xcode does not update automatically (at least 5.x version didn't) is the app's Localizable Strings. You can build a fresh file from Main.storyboard as follows:
In the project Navigator (the leftmost pane) click on the Main.storyboard file. In the Utilities pane (the rightmost pane) click on Show the File inspector icon. It is the leftmost icon in blue in the image below:
.
On the right pane that will appear, one of the sections will be Localization:
Uncheck the English (Localizable Strings) row and in the window that will pop-up check the Delete localized resource files from disk and click the Remove button (you do not have to check delete, in which case Xcode will ask for a permission to override it when you build it next).
Then check English (Localizable Strings) again to build it from scratch.
Using Xcode 6 the following worked for me:
I changed the localization for a language from "Localizable Strings" to "Interface Builder ..." like suggested at the SO question posted by h.orim. However the setting did not change, it still was set to "Localizable Strings". The next step now is to do that again, so Xcode will find the Storyboard it just created and show a prompt asking if it should be used or replaced. Now click on "Use file" instead of "Replace", otherwise the same will happen again.
Now you should have a localized Storyboard in the desired language. After you now switch back to "Localizable Strings" you will have a file containing all current strings used in the storyboard with your previous translations still in place.
Another way is to do it manually by selecting on the storyboard the field to translate. Go to the "Identity Inspector" and copy the Object ID (something like HP8-op-SmX).
After that, open the storyboard langage file (Main.strings, most cases) and past the Object ID. Depending your needs, you just have to add .text or .placeholder.
"HP8-op-SmX.placeholder" = "My translated placeholder text";
"HP9-op-VvD.text" = "My translated text";
Save, clean & build. It's a little bit painful but can save a lot of time if you only need to translate few things.
You can use a script called UpdatStoryboardStrings for this!Get it here: https://github.com/AppliedIS/iOSL10n
Intructions for use: http://blog.appliedis.com/2013/05/22/localization-of-an-xcode-ios-app-part-2/
With Xcode 6+, ideally developers should not have to manually manage strings files. Use XLIFF export to automatically gather development language strings to send to translators, and then use XLIFF import to update the strings files with translations.
https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LocalizingYourApp/LocalizingYourApp.html#//apple_ref/doc/uid/10000171i-CH5-SW9
Another option is to use ibtool --export-strings-file directly.
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/ibtool.1.html
There are two options:
Option 1
Xcode can "reload" the file by converting the file to either an [Interface Builder Cocoa Touch Storyboard] file type or a [Localizable Strings] file type.
Select your base storyboard file from the Project Navigator
Find the Localization section in the File Inspector
If your file is currently a [Localizable Strings], change it to [Interface Builder Cocoa Touch Storyboard] or vice-versa.
Xcode should have converted your storyboard to the current version, while preserving your old localization efforts. Here you can change the file back to the original file type if you would like.
Option 2
Use ibtool to extract the strings in your storyboard.
Open the Terminal application
Locate your Base.lproj directory
Use this line to extract the strings:
ibtool MainStoryboard.storyboard --generate-strings-file file_name.strings
After ibtool extracts the strings to file_name.strings, you can copy and paste it to your original .strings file
Tested with Xcode 11, you can simply deselect the language.
Do not delete the file on disk.
And then choose to use the existing file.
The old translations will be kept and the new keys will be added.
I came across this About dialog of the Sparrow Mail app. Is this possible 'out of the box' within the AppDelegate or is this a real 'window' I will have to develop so I can replace the default Apple generated one with the credits?
The About Box gets its content from the "Credits" RTF file that is present in all app-level projects created by Xcode templates. You can edit it within Xcode or in any rich text editor (including hyperlinks, formatting, etc.).
The icon is taken from the app's bundle settings (Info.plist) and requires no extra work beyond setting the app's icon (so don't include it in your RTF file). Similarly, the version is taken from the bundle settings. In other words, everything below the icon and version line comes from the rich text file.
Can someone outline the procedure to use custom fonts in Xcode's attributes builder. I was hoping to use the .storybuild file (not using code) to create a UILabel with the custom font "Delicious". I downloaded the .otf file, added it to the Font Book, copied the font file into the project folder in Xcode, added "Fonts provided by application" with the font name to the -file.plist. But I still cannot see the font in the attributes builder drop down font list. Do I need to do anything else?
PS: I am using Xcode 4.5.
I don't believe you can get custom fonts to show in the dropdown in interface builder. IB only shows fonts available on the device OS you are targeting. If you want to use custom fonts, you will have to set them in some code.
http://kgriff.posterous.com/45359635
I'm using a CC-BY FontAwesome typeface for icons on my Twitter Bootstrap-driven website. Now I want to use it in an image editor for a prototype of another website. But it does not work. I cannot use its webfont-TTF with my image editing application. How can I convert it to a normal font?
Please dont give me links to free-/shareware closed-source utilites. I want to know, why does this happening and implement my own script which would "fix" this font.
FontAwesome should work out of the box. Heres how to use it:
Download FontAwesome. Then open fonts/FontAwesome.otf and install it (either with fontbook on osx or by adding it to your fonts folder on windows).
Use the Cheatsheet to actually use specific icons. Find the icon you want there, select the icon and copy it.
Switch to your image editor, create a text item, set the font to FontAwesome, and paste the symbol you copied.
I assume you are talking about http://fontawesome.io/ .
If so there is nothing wrong with the TTF version of this font and no reason to convert it. I have tested the font on linux by dropping the .ttf file in /usr/share/fonts/ and it is useable in LibreOffice, Gimp and Terminal.
You problem is almost certainly one of:
The process you used to install the font
You aren't entering the correct Unicode characters or your image editor doesn't support Unicode.
However you failed to provide enough details. You haven't even defined what you mean by "it does not work". Please update your question with details like the process you used, a link to the actual font you downloaded and the operating system and image editor you're using.
In case you're still looking for a solution: the easy way is to convert the included SVG font to usable TrueType or OpenType, using e.g. FontForge or an online service.
AFAIK SVG fonts have no DRM flags, unlike TrueType.
I have tried a bunch of JSFL scripts to change textfields' fonts of a fla library. I used those scripts to change textfields' fonts for an embedded font which do exist in the library. All scripts run fine through Flash CS3 but always fail through Flash CS4
Let's give an example: replacing the "Arial" font used by all textfields in the fla scene by the "myEmbeddedArial*" embedded font (symbol).
The jsfl font replacement instruction is the following one:
textElement.setTextAttr("face", "myEmbeddedArial*");
I can give a lots of all details about this issue but does someone already observed it and may know about its root cause ?
Thanks
P.S: Note the Find/Replace "Font" feature of Flash CS4 IDE works properly only if the textfields contain not emtpy strings and only if the symbol including this textfield is in a scene and only if you search in "Current Document" (and not in "Current Scene").
I am not sure if it works for you but maybe:
http://blog.samueltoth.com/?p=142
Good luck,
Rob
I think I found a successful workaround. So the only way to properly do that in CS4 IDE is to use the find/replace function, but the textfields' content must not be empty.
Use your jsfl script to fulfill all empty textfields of your symbol library with a marker string like '####'.
Ensure all the embedded font symbols used on your textfields are in your fla library. Because find/replace tool will not parse the textfields which use some embedded font symbols which don't exist in the library. Indeed some embedded font symbols may have been deleted and/or mapped on a default font (manually or during a file conversion from CS3 to CS4). Especially take care to case sensitivity on the embedded font symbol names.
Create the missing embedded font symbols used on your textfields (with the right case sensitive names) before using find/replace feature.
Create the new embedded font symbols you want to use to replace the old embedded font symbols.
Now you should be able to use find/replace feature of CS4 properly even with embedded font symbols. Open find/replace window. Select "Search in: Current Document" (not in "Current Scene"). Create a new layer on your main scene. Create an instance of all the movie clips you have in your library in this layer (e.g: select all the symbol library then drag & drop the selection in the scene).
Don't forget to remove your '####' string marker from all the textfields by using your jsfl script or the find/replace Text feature of the IDE. Finally delete the layer you created for the font replacement operation and all the symbol instances in it.