Upgrading to 10.1 Gold

This document lists the major changes that affect applications that are upgrading from the 10.1 beta release to the 10.1 Gold release of Cascades. Upward compatible changes are not listed here. Here are some links that you can visit for more information:

Changes to APIs

In the audio_manager_device.h library, the value wifidisplay in the AUDIO_DEVICE_NAMES enumeration has been removed. The value miracast has been added.

Changes to fonts

If your app uses one of the replaced fonts that are listed below, and you don't include a fallback mechanism if the font isn't found, your app might not work properly. The fontconfig library provides a fallback mechanism for loading fonts. Your app should not load fonts directly from the font file path because those file paths could change over time.

The following fonts have been replaced or removed:

Traditional Chinese fonts

The Traditional Chinese font has been replaced, to align with Simplified Chinese and other platforms (such as iOS, Android, and Nokia), which all use Gothic style (sans-serif) for Traditional Chinese.

The new fonts are MHeiHK.ttf (medium) and MHeiHKBd.ttf (bold), and these fonts have a family name of MHei HK. The light weight version of the current Traditional Chinese font (MSung CP950 - MSungL.cp950.v311.1.ttf ) has been removed. The medium weight version of the font (MSungM.cp950.v311.1.ttf) has not been removed. The fontconfig library has been updated.

If your app accesses font files directly, you will need to make a change. A simple change is to make sure that the font file exists before trying to load a font. The recommended fix is to use the fontconfig library. An app can use the fontconfig API to return a serif font that supports Traditional Chinese, which you can access without needing to know where the font is stored.

For example, the following code sample tries to get the serif Traditional Chinese font by using the fontconfig library and matching the font with a given pattern. Then it prints out the file path that can be used to open a file.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fontconfig.h>
...
FcObjectSet     *os = 0;
FcFontSet       *fs;
FcPattern       *pat;
FcResult        result;
 
const char* query = "serif:lang=zh-tw";
 
pat = FcNameParse ((FcChar8 *) query);
 
FcConfigSubstitute (0, pat, FcMatchPattern);
FcDefaultSubstitute (pat);
 
fs = FcFontSetCreate ();
 
FcPattern   *match;
match = FcFontMatch (0, pat, &result);
if (match)
    FcFontSetAdd (fs, match);
 
FcPatternDestroy (pat);
 
if (fs)
{
    int j;
 
    for (j = 0; j < fs->nfont; j++)
    {
        FcPattern *font;
 
        font = FcPatternFilter (fs->fonts[j], os);
 
        FcChar8 *s;
 
        FcChar8* path;
        if (FcPatternGetString(fs->fonts[j], FC_FILE, 0, &path) == FcResultMatch)
        {
            printf("[%s]  ", path);
        }

 
        FcPatternDestroy (font);
    }
    FcFontSetDestroy (fs);
}
...

DejaVu fonts

The DejaVu font has been upgraded to version 2.33. The fonts/font_repository/dejavu-ttf-2.17/ folder has been removed. The fontconfig library has been updated.

If your app accesses these font files directly, you will need to make a change. A simple change is to make sure that the font file exists before trying to load a font. The recommended change is to use the fontconfig library. An app can use the fontconfig API to return a font with the DejaVu Sans family name, which you can access without needing to know where the font is stored.

For example, you can use the following query with the code sample above to get the font by font family:

constchar* query = "\"DejaVu Sans\":bold";

To learn about the rules for writing queries using the fontconfig library, see Font Properties and Font Matching on the freedesktop.org website.

HYGothic-Medium font

This font has been removed. You can use the Malgun Gothic font as an alternative.

Changes to application behavior

The TitleBar control now supports either a sticky TitleBar or a non-sticky TitleBar to allow your UI to display more content on a device with a smaller screen. A non-sticky TitleBar will scroll off of the screen when the user scrolls towards the bottom of the device on vertically scrollable pages. A sticky TitleBar will stay fixed at the top of the screen.

The default TitleBar behavior on an all-touch device is sticky.

The default TitleBar behavior on a device with a physical keyboard is non-sticky so that more of your UI will remain on the device screen.

If you are building an app to run on both an all-touch device and a device with a physical keyboard, you will notice a difference in how your TitleBar behaves in this release. This has implications for applications that align important elements at the bottom of the screen. The user may have to scroll the screen up to see the important content and may scroll the TitleBar off of the screen. You can use the scrollBehavior property to change the default behavior of the TitleBar in your app.

TitleBar {   
    scrollBehavior: TitleBarScrollBehavior.Sticky 
} 

File system access changes

In QML, you must prefix the absolute file path of an external resource with file:// or your app won't be able to access the resource. This is very important in apps that use the FilePicker APIs, which return absolute file paths that are not prefixed with file://. File paths returned from FilePicker must be prefixed with file:// to be used as an absolute path to ImageView or MediaPlayer. For more information about accessing external images, see External images.

If your app was compiled with a version of the SDK prior to the 10.1 Gold release, it will continue to work, but it is a good practice to prefix your absolute paths with file:// in QML anyway.

Last modified: 2013-12-21

comments powered by Disqus