I created a livecode project. I designed my UI by changing colors and fonts.
After creating that app, I deploy it to an android installer file (.apk file). When I launch the application to my android device, the UI from android device is not exactly the same as in the livecode. The text from the labels and buttons are getting too close which is annoying.
If you're not including a font in your APK file, chances are that Android chooses a font different from the font chosen by iOS. Either set the textFont of the field to a font that is available on both platforms or include your own font. If you include a font with the standalone and make sure that it is located next to the engine file, the font will be available. You can check that a font is available by using the fontNames:
put ("Font Name" is among the lines of the fontNames) into myFontAvailable
The default textFont of a field is empty, which means that it is inherited from the stack. If the textFont of a stack is empty, the system font is used. On Windows, the system font is Segoe UI, on Mac OS X it is a different font. On Android and iOS, the system font is different again. If you want the font to be the same on all platforms, you have to set the textFont of the stack (or field) to a font name that is available on all platforms or include your own font.
Related
what is the difference between "Create downloadable font" and "Add font to project"?
what is the best way?
"Create downloadable font" refers to creating a font that can be downloaded and installed on the device at runtime. This allows the font to be dynamically loaded by the application and provides a flexible way to change the font without requiring an update to the app.
"Add font to project" refers to adding the font directly to the project resources, which will be packaged with the app when it is built. This makes the font available to the application at all times and is a simpler solution for small projects or for cases where the font will not change.
The choice between the two methods depends on the requirements of the project, including the size of the font file, the need for dynamic updates, and the requirement to install the font on the device.
I have an OpenGL renderer that uses FreeType to render text. I would like to be able to use system fonts packaged with Android. There is a way on iOS to get the ttf font data for system fonts (see accepted answer here: On iOS, can I access the system-provided font's TTF file). Is there something equivalent on Android? Is there an API for getting the source file for a system font based on the font name, ideally without having to do any guesswork about where certain system files are stored?
My company ships Android devices to control industrial equipment we make. We only ship one specific device running Android 2.36 that we buy in quantity and load our own app on, so we don't have to worry about accommodating different layouts, resolutions, etc.
We have a customer in Israel who would like us to have the legends on our buttons in Hebrew. Android 2.36 doesn't have good support for Hebrew (or RTL languages in general) so what we thought we would do is replace the text for these buttons with an image of the Hebrew text.
Since Hebrew is not a supported language on these devices I can't just put the whole device in Hebrew and have Android select the layout XML files with the images instead of text to use at runtime, so I think I might have to do it at build time, in other words have some kind of switch or setting that says use THESE layout resources instead of THOSE layout resources when building a Hebrew version of our product.
My Question: What's a good way to do that? Is there a simple way to force it to use a particular set of layout XML files at build time or am I thinking about this wrong?
If you're using Gradle for Android with Android Studio, this would be a fine place to use product flavors:
Have the bulk of your code and resources be in the main sourceset as normal
Define standard and hebrew product flavors in your build.gradle file
Have the normal (non-Hebrew) resources be in a standard sourceset
Have the Hebrew resources be in a hebrew sourceset
Then, a hebrew build will use the Hebrew layouts, while a standard build would use the normal layouts.
If Gradle for Android is not an option, since you control the hardware, you could drop some file in some special spot on the device, and check that when your process starts to determine if you should be in Hebrew-compatibility mode or not. This presumes that the users of the Android device do not have arbitrary access to it (so external storage would be safe) or that you inject the file into internal storage after installing your app (adb shell run-as should handle this, though I have only ever used it for read operations, not write operations).
I was going to say you could use the layout-LANG to specify region based layouts, but I don't think you can do that if the language isn't supported there.
https://developer.android.com/guide/topics/resources/localization.html
Does your app have a settings screen? You could simply have a setting to change all the layouts in run time.
Do you use Android Studio? Android studio allows different build profiles for debug, release, etc. You could set one up for Israel.
I realised recently that the Android Browser doesn't have any of the fonts I have in my font stack as a Times Replacement with the help from http://www.codestyle.org/css/font-family/index.shtml.
"Times New Roman",Times,FreeSerif,"DejaVu Serif",serif
I'm not angry about it, because it looks nice. But I want to know what is the font's name so that I can include it into my font stack.
You don’t need to add a name, since the Android browser checks your current list, notices that none of the specific names matches, and uses serif, which is mapped to the browser’s serif font. Similarly for the Android sans-serif font (which is what your heading refers to...), use just the generic name sans-serif.
Oddly enough, the often-advertised name Droid Serif does not work. It is just yet another unrecognized name to the Android browser. See e.g. the question Using CSS font-family to select Droid fonts not working on Android (the question is more useful than the comments and answers).
The original Android font was "Droid" (Serif version is "Droid Serif"): http://en.wikipedia.org/wiki/Droid_(font)
The font in the newer devices is "Roboto", though I'm not sure if it has a serif version.
I saw that on iPhone there is a truetype font called Apple Color Emoji. It contains the emoticons that exist on iPhones which can be used in any application.
I wonder:
How is this font displayed in multicolor?! Truetype fonts can only include black and white glyphs.
Can this font, or one like it, be used on Android phones?
Apple is using a proprietary extension to the OpenType standard. Basically, they just store pre-rasterized color PNGs in a proprietary extension "block" within the TTF file (reference, corroboration).
The only reason this works is because they also provide the full stack between that font extension and the screen (font rasterization, system graphics library, text rendering widgets). There's no standardized way to accomplish this across all platforms/libraries.
The font uses embedded PNGs and they are stored in a sbix table.
Apple Color Emoji cannot be used in Android, but a Google CBLC/CBDT formatted font can.
There are four methods for implementing color in Open Type fonts right now:
Apple's SBIX - Embedded PNGs
Google's CBLC+CBDT - Embedded PNGs
Microsoft's COLR+CPAL - Colored glyphs
Adobe/Mozilla/W3C's SVG+CPAL - SVG in OpenType
The complete list of OpenType tables.
You can disassemble/reassemble the font using ttx from FontTools(pypi, github) for more details.