From: Paul Wisbey
Date: Mon, 16 Mar 2015 14:36:34 +0000 (+0000)
Subject: Respect the accessibility settings
X-Git-Tag: dali_1.0.38~11^2~33
X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=f12006bb207999beb65a3927d4c88292c504ac12
Respect the accessibility settings
Change-Id: I51c5e78b40d5fd641c040b9c8c2944894f94efe9
---
diff --git a/dali-toolkit/internal/styling/style-manager-impl.cpp b/dali-toolkit/internal/styling/style-manager-impl.cpp
index fa453dd..60fa868 100644
--- a/dali-toolkit/internal/styling/style-manager-impl.cpp
+++ b/dali-toolkit/internal/styling/style-manager-impl.cpp
@@ -36,6 +36,7 @@ namespace
const char* LANDSCAPE_QUALIFIER = "landscape";
const char* PORTRAIT_QUALIFIER = "portrait";
+const char* FONT_SIZE_QUALIFIER = "font-size-";
const char* DEFAULT_THEME = DALI_STYLE_DIR "tizen-default-theme.json";
@@ -99,7 +100,8 @@ Toolkit::StyleManager StyleManager::Get()
}
StyleManager::StyleManager()
- : mOrientationDegrees( 0 ) // Portrait
+: mOrientationDegrees( 0 ), // Portrait
+ mDefaultFontSize( -1 )
{
// Add theme builder constants
mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH;
@@ -110,6 +112,8 @@ StyleManager::StyleManager()
if( styleMonitor )
{
styleMonitor.StyleChangeSignal().Connect( this, &StyleManager::StyleMonitorChange );
+
+ mDefaultFontSize = styleMonitor.GetDefaultFontSize();
}
}
@@ -266,6 +270,14 @@ void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control contro
// Remove the last qualifier in an attempt to find a style that is valid
qualifiers.pop_back();
}
+
+ if( mDefaultFontSize >= 0 )
+ {
+ // Apply the style for logical font size
+ std::stringstream fontSizeQualifier;
+ fontSizeQualifier << styleName << "-" << FONT_SIZE_QUALIFIER << mDefaultFontSize;
+ builder.ApplyStyle( fontSizeQualifier.str(), control );
+ }
}
void StyleManager::ApplyThemeStyle( Toolkit::Control control )
@@ -380,6 +392,11 @@ void StyleManager::CacheBuilder( Toolkit::Builder builder, const std::string& ke
void StyleManager::StyleMonitorChange( StyleMonitor styleMonitor, StyleChange styleChange )
{
+ if( styleChange.defaultFontSizeChange )
+ {
+ mDefaultFontSize = styleMonitor.GetDefaultFontSize();
+ }
+
mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), styleChange );
}
diff --git a/dali-toolkit/internal/styling/style-manager-impl.h b/dali-toolkit/internal/styling/style-manager-impl.h
index 648c11d..09d0c13 100644
--- a/dali-toolkit/internal/styling/style-manager-impl.h
+++ b/dali-toolkit/internal/styling/style-manager-impl.h
@@ -241,6 +241,8 @@ private:
Orientation mOrientation; ///< Handle to application orientation object
int mOrientationDegrees; ///< Directly set value of orientation
+ int mDefaultFontSize; ///< Logical size, not a point-size
+
std::string mThemeFile; ///< The full path of the current theme file
Property::Map mThemeBuilderConstants; ///< Contants to give the theme builder
diff --git a/dali-toolkit/internal/text/multi-language-support-impl.cpp b/dali-toolkit/internal/text/multi-language-support-impl.cpp
index fa50497..6553c51 100644
--- a/dali-toolkit/internal/text/multi-language-support-impl.cpp
+++ b/dali-toolkit/internal/text/multi-language-support-impl.cpp
@@ -450,12 +450,30 @@ void MultilanguageSupport::ValidateFonts( const Vector& text,
{
// Check in the valid fonts cache.
ValidateFontsPerScript* validateFontsPerScript = *( validFontsPerScriptCacheBuffer + script );
+
+ if( NULL == validateFontsPerScript )
+ {
+ validateFontsPerScript = new ValidateFontsPerScript();
+ }
+
if( NULL != validateFontsPerScript )
{
if( !validateFontsPerScript->FindValidFont( fontId ) )
{
// Use the font client to validate the font.
- const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
+ GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
+
+ // Emojis are present in many monochrome fonts; prefer color by default.
+ if( TextAbstraction::EMOJI == script &&
+ 0u != glyphIndex )
+ {
+ BufferImage bitmap = fontClient.CreateBitmap( fontId, glyphIndex );
+ if( bitmap &&
+ Pixel::BGRA8888 != bitmap.GetPixelFormat() )
+ {
+ glyphIndex = 0;
+ }
+ }
if( 0u == glyphIndex )
{
@@ -472,28 +490,6 @@ void MultilanguageSupport::ValidateFonts( const Vector& text,
}
}
}
- else
- {
- // Use the font client to validate the font.
- const GlyphIndex glyphIndex = fontClient.GetGlyphIndex( fontId, character );
-
- if( 0u == glyphIndex )
- {
- // Get the point size of the current font. It will be used to get a default font id.
- pointSize = fontClient.GetPointSize( fontId );
-
- // The font is not valid. Set to zero and a default one will be set.
- fontId = 0u;
- }
- else if( !IsValidForAllScripts( character ) )
- {
- // Add the font to the valid font cache.
- validateFontsPerScript = new ValidateFontsPerScript();
- *( validFontsPerScriptCacheBuffer + script ) = validateFontsPerScript;
-
- validateFontsPerScript->mValidFonts.PushBack( fontId );
- }
- }
}
} // !isDefault
diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp
index 3981ce1..04093a4 100644
--- a/dali-toolkit/internal/text/text-controller.cpp
+++ b/dali-toolkit/internal/text/text-controller.cpp
@@ -677,6 +677,18 @@ void Controller::SetDefaultFontFamily( const std::string& defaultFontFamily )
mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
mImpl->mOperationsPending = ALL_OPERATIONS;
mImpl->mRecalculateNaturalSize = true;
+
+ // Clear the font-specific data
+ mImpl->mLogicalModel->mFontRuns.Clear();
+ mImpl->mVisualModel->mGlyphs.Clear();
+ mImpl->mVisualModel->mGlyphsToCharacters.Clear();
+ mImpl->mVisualModel->mCharactersToGlyph.Clear();
+ mImpl->mVisualModel->mCharactersPerGlyph.Clear();
+ mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
+ mImpl->mVisualModel->mGlyphPositions.Clear();
+ mImpl->mVisualModel->mLines.Clear();
+
+ RequestRelayout();
}
const std::string& Controller::GetDefaultFontFamily() const
@@ -700,6 +712,18 @@ void Controller::SetDefaultFontStyle( const std::string& defaultFontStyle )
mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
mImpl->mOperationsPending = ALL_OPERATIONS;
mImpl->mRecalculateNaturalSize = true;
+
+ // Clear the font-specific data
+ mImpl->mLogicalModel->mFontRuns.Clear();
+ mImpl->mVisualModel->mGlyphs.Clear();
+ mImpl->mVisualModel->mGlyphsToCharacters.Clear();
+ mImpl->mVisualModel->mCharactersToGlyph.Clear();
+ mImpl->mVisualModel->mCharactersPerGlyph.Clear();
+ mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
+ mImpl->mVisualModel->mGlyphPositions.Clear();
+ mImpl->mVisualModel->mLines.Clear();
+
+ RequestRelayout();
}
const std::string& Controller::GetDefaultFontStyle() const
@@ -723,6 +747,18 @@ void Controller::SetDefaultPointSize( float pointSize )
mImpl->mFontDefaults->mFontId = 0u; // Remove old font ID
mImpl->mOperationsPending = ALL_OPERATIONS;
mImpl->mRecalculateNaturalSize = true;
+
+ // Clear the font-specific data
+ mImpl->mLogicalModel->mFontRuns.Clear();
+ mImpl->mVisualModel->mGlyphs.Clear();
+ mImpl->mVisualModel->mGlyphsToCharacters.Clear();
+ mImpl->mVisualModel->mCharactersToGlyph.Clear();
+ mImpl->mVisualModel->mCharactersPerGlyph.Clear();
+ mImpl->mVisualModel->mGlyphsPerCharacter.Clear();
+ mImpl->mVisualModel->mGlyphPositions.Clear();
+ mImpl->mVisualModel->mLines.Clear();
+
+ RequestRelayout();
}
float Controller::GetDefaultPointSize() const
diff --git a/dali-toolkit/styles/mobile/tizen-dark-theme.json b/dali-toolkit/styles/mobile/tizen-dark-theme.json
index 238840c..8deaa50 100644
--- a/dali-toolkit/styles/mobile/tizen-dark-theme.json
+++ b/dali-toolkit/styles/mobile/tizen-dark-theme.json
@@ -34,15 +34,57 @@ distributing this software or its derivatives.
"textlabel":
{
"font-family":"SamsungSans",
- "font-style":"Regular",
- "point-size":12
+ "font-style":"Regular"
},
+
+ "textlabel-font-size-0":
+ {
+ "point-size":8
+ },
+ "textlabel-font-size-1":
+ {
+ "point-size":10
+ },
+ "textlabel-font-size-2":
+ {
+ "point-size":15
+ },
+ "textlabel-font-size-3":
+ {
+ "point-size":19
+ },
+ "textlabel-font-size-4":
+ {
+ "point-size":25
+ },
+
"textfield":
{
"font-family":"SamsungSans",
- "font-style":"Regular",
- "point-size":12
+ "font-style":"Regular"
},
+
+ "textfield-font-size-0":
+ {
+ "point-size":10
+ },
+ "textfield-font-size-1":
+ {
+ "point-size":10
+ },
+ "textfield-font-size-2":
+ {
+ "point-size":10
+ },
+ "textfield-font-size-3":
+ {
+ "point-size":10
+ },
+ "textfield-font-size-4":
+ {
+ "point-size":10
+ },
+
"scrollview":
{
"overshoot-effect-color":"B018"
diff --git a/packaging/dali-toolkit-mobile.spec b/packaging/dali-toolkit-mobile.spec
index cc27ae0..79cadd4 100644
--- a/packaging/dali-toolkit-mobile.spec
+++ b/packaging/dali-toolkit-mobile.spec
@@ -1,6 +1,6 @@
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.0.33
+Version: 1.0.34
Release: 1
Group: System/Libraries
License: Apache-2.0
diff --git a/packaging/dali-toolkit.spec b/packaging/dali-toolkit.spec
index fb616da..22bac10 100644
--- a/packaging/dali-toolkit.spec
+++ b/packaging/dali-toolkit.spec
@@ -7,6 +7,8 @@ License: Apache-2.0
URL: https://review.tizen.org/git/?p=platform/core/uifw/dali-toolkit.git;a=summary
Source0: %{name}-%{version}.tar.gz
+%define dali_profile MOBILE
+
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: dali
@@ -58,7 +60,7 @@ cd %{_builddir}/dali-toolkit-%{version}/build/tizen
autoreconf --install
DALI_DATA_RW_DIR="%{dali_data_rw_dir}" ; export DALI_DATA_RW_DIR
DALI_DATA_RO_DIR="%{dali_data_ro_dir}" ; export DALI_DATA_RO_DIR
-%configure
+%configure --enable-profile=%{dali_profile}
make %{?jobs:-j%jobs}
##############################