Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (94162 => 94163)
--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp 2011-08-31 08:35:54 UTC (rev 94162)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp 2011-08-31 08:45:32 UTC (rev 94163)
@@ -2199,102 +2199,65 @@
return EINA_TRUE;
}
-const char* ewk_view_setting_font_standard_get(const Evas_Object *o)
+const char *ewk_view_font_family_name_get(const Evas_Object *o, Ewk_Font_Family font_family)
{
EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
- return priv->settings.font_standard;
-}
-Eina_Bool ewk_view_setting_font_standard_set(Evas_Object *o, const char *family)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
- if (eina_stringshare_replace(&priv->settings.font_standard, family))
- priv->page_settings->setStandardFontFamily(AtomicString::fromUTF8(family));
- return EINA_TRUE;
+ switch (font_family) {
+ case EWK_FONT_FAMILY_STANDARD:
+ return priv->settings.font_standard;
+ case EWK_FONT_FAMILY_CURSIVE:
+ return priv->settings.font_cursive;
+ case EWK_FONT_FAMILY_FANTASY:
+ return priv->settings.font_fantasy;
+ case EWK_FONT_FAMILY_MONOSPACE:
+ return priv->settings.font_monospace;
+ case EWK_FONT_FAMILY_SERIF:
+ return priv->settings.font_serif;
+ case EWK_FONT_FAMILY_SANS_SERIF:
+ return priv->settings.font_sans_serif;
+ }
+ return 0;
}
-const char* ewk_view_setting_font_cursive_get(const Evas_Object *o)
+Eina_Bool ewk_view_font_family_name_set(Evas_Object *o, Ewk_Font_Family font_family, const char *name)
{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
- return priv->settings.font_cursive;
-}
-
-Eina_Bool ewk_view_setting_font_cursive_set(Evas_Object *o, const char *family)
-{
EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
- if (eina_stringshare_replace(&priv->settings.font_cursive, family))
- priv->page_settings->setCursiveFontFamily(AtomicString::fromUTF8(family));
- return EINA_TRUE;
-}
-const char* ewk_view_setting_font_fantasy_get(const Evas_Object *o)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
- return priv->settings.font_fantasy;
-}
+ switch (font_family) {
+ case EWK_FONT_FAMILY_STANDARD:
+ if (eina_stringshare_replace(&priv->settings.font_standard, name))
+ priv->page_settings->setStandardFontFamily(AtomicString::fromUTF8(name));
+ break;
+ case EWK_FONT_FAMILY_CURSIVE:
+ if (eina_stringshare_replace(&priv->settings.font_cursive, name))
+ priv->page_settings->setCursiveFontFamily(AtomicString::fromUTF8(name));
+ break;
+ case EWK_FONT_FAMILY_FANTASY:
+ if (eina_stringshare_replace(&priv->settings.font_fantasy, name))
+ priv->page_settings->setFantasyFontFamily(AtomicString::fromUTF8(name));
+ break;
+ case EWK_FONT_FAMILY_MONOSPACE:
+ if (eina_stringshare_replace(&priv->settings.font_monospace, name))
+ priv->page_settings->setFixedFontFamily(AtomicString::fromUTF8(name));
+ break;
+ case EWK_FONT_FAMILY_SERIF:
+ if (eina_stringshare_replace(&priv->settings.font_serif, name))
+ priv->page_settings->setSerifFontFamily(AtomicString::fromUTF8(name));
+ break;
+ case EWK_FONT_FAMILY_SANS_SERIF:
+ if (eina_stringshare_replace(&priv->settings.font_sans_serif, name))
+ priv->page_settings->setSansSerifFontFamily(AtomicString::fromUTF8(name));
+ break;
+ default:
+ return EINA_FALSE;
+ }
-Eina_Bool ewk_view_setting_font_fantasy_set(Evas_Object *o, const char *family)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
- if (eina_stringshare_replace(&priv->settings.font_fantasy, family))
- priv->page_settings->setFantasyFontFamily(AtomicString::fromUTF8(family));
return EINA_TRUE;
}
-const char *ewk_view_setting_font_monospace_get(const Evas_Object *o)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
- return priv->settings.font_monospace;
-}
-
-Eina_Bool ewk_view_setting_font_monospace_set(Evas_Object *o, const char *family)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
- if (eina_stringshare_replace(&priv->settings.font_monospace, family))
- priv->page_settings->setFixedFontFamily(AtomicString::fromUTF8(family));
- return EINA_TRUE;
-}
-
-const char *ewk_view_setting_font_serif_get(const Evas_Object *o)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
- return priv->settings.font_serif;
-}
-
-Eina_Bool ewk_view_setting_font_serif_set(Evas_Object *o, const char *family)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
- if (eina_stringshare_replace(&priv->settings.font_serif, family))
- priv->page_settings->setSerifFontFamily(AtomicString::fromUTF8(family));
- return EINA_TRUE;
-}
-
-const char *ewk_view_setting_font_sans_serif_get(const Evas_Object *o)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
- return priv->settings.font_sans_serif;
-}
-
-Eina_Bool ewk_view_setting_font_sans_serif_set(Evas_Object *o, const char *family)
-{
- EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
- EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
- if (eina_stringshare_replace(&priv->settings.font_sans_serif, family))
- priv->page_settings->setSansSerifFontFamily(AtomicString::fromUTF8(family));
- return EINA_TRUE;
-}
-
Eina_Bool ewk_view_setting_spatial_navigation_get(const Evas_Object *o)
{
EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (94162 => 94163)
--- trunk/Source/WebKit/efl/ewk/ewk_view.h 2011-08-31 08:35:54 UTC (rev 94162)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h 2011-08-31 08:45:32 UTC (rev 94163)
@@ -312,6 +312,18 @@
/// Creates a type name for @a _Ewk_View_Mode.
typedef enum _Ewk_View_Mode Ewk_View_Mode;
+/// Defines the font families.
+enum _Ewk_Font_Family {
+ EWK_FONT_FAMILY_STANDARD = 0,
+ EWK_FONT_FAMILY_CURSIVE,
+ EWK_FONT_FAMILY_FANTASY,
+ EWK_FONT_FAMILY_MONOSPACE,
+ EWK_FONT_FAMILY_SERIF,
+ EWK_FONT_FAMILY_SANS_SERIF
+};
+/// Creates a type name for @a _Ewk_Font_Family.
+typedef enum _Ewk_Font_Family Ewk_Font_Family;
+
/**
* @brief Creates a type name for @a _Ewk_Tile_Unused_Cache.
*
@@ -1656,114 +1668,27 @@
EAPI Eina_Bool ewk_view_setting_font_monospace_size_set(Evas_Object *o, int size);
/**
- * Gets the font standard family.
+ * Gets the name of font for the given font family.
*
- * @param o view object to get the font standard family
+ * @param o view object to get name of font the for font family
+ * @param font_family the font family as @a Ewk_Font_Family enum to get font name
*
- * @return the font standard family on success or @c 0 on failure
+ * @return the name of font family
*/
-EAPI const char *ewk_view_setting_font_standard_get(const Evas_Object *o);
+EAPI const char *ewk_view_font_family_name_get(const Evas_Object *o, Ewk_Font_Family font_family);
/**
- * Sets the font standard family.
+ * Sets the font for the given family.
*
- * @param o view object to set the font standard family
+ * @param o view object to set font for the given family
+ * @param font_family the font family as @a Ewk_Font_Family enum
+ * @param name the font name to set
*
* @return @c EINA_TRUE on success or @c EINA_FALSE on failure
*/
-EAPI Eina_Bool ewk_view_setting_font_standard_set(Evas_Object *o, const char *family);
+EAPI Eina_Bool ewk_view_font_family_name_set(Evas_Object *o, Ewk_Font_Family font_family, const char *name);
/**
- * Gets the font cursive family.
- *
- * @param o view object to get the font cursive family
- *
- * @return the font cursive family on success or @c 0 on failure
- */
-EAPI const char *ewk_view_setting_font_cursive_get(const Evas_Object *o);
-
-/**
- * Sets the font standard family.
- *
- * @param o view object to set the font standard family
- *
- * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
- */
-EAPI Eina_Bool ewk_view_setting_font_cursive_set(Evas_Object *o, const char *family);
-
-/**
- * Gets the font monospace family.
- *
- * @param o view object to get the font monospace family
- *
- * @return the font monospace family on success or @c 0 on failure
- */
-EAPI const char *ewk_view_setting_font_monospace_get(const Evas_Object *o);
-
-/**
- * Sets the font monospace family.
- *
- * @param o view object to set the font monospace family
- *
- * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
- */
-EAPI Eina_Bool ewk_view_setting_font_monospace_set(Evas_Object *o, const char *family);
-
-/**
- * Gets the font fantasy family.
- *
- * @param o view object to get the font fantasy family
- *
- * @return the font fantasy family on success or @c 0 on failure
- */
-EAPI const char *ewk_view_setting_font_fantasy_get(const Evas_Object *o);
-
-/**
- * Sets the font monospace family.
- *
- * @param o view object to set the font monospace family
- *
- * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
- */
-EAPI Eina_Bool ewk_view_setting_font_fantasy_set(Evas_Object *o, const char *family);
-
-/**
- * Gets the font serif family.
- *
- * @param o view object to get the font serif family
- *
- * @return the font serif family on success or @c 0 on failure
- */
-EAPI const char *ewk_view_setting_font_serif_get(const Evas_Object *o);
-
-/**
- * Sets the font serif family.
- *
- * @param o view object to set the font serif family
- *
- * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
- */
-EAPI Eina_Bool ewk_view_setting_font_serif_set(Evas_Object *o, const char *family);
-
-/**
- * Gets the font sans serif family.
- *
- * @param o view object to get the font sans serif family
- *
- * @return the font sans serif family on success or @c 0 on failure
- */
-EAPI const char *ewk_view_setting_font_sans_serif_get(const Evas_Object *o);
-
-/**
- * Sets the font sans serif family.
- *
- * @param o view object to set the font serif family
- *
- * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
- */
-EAPI Eina_Bool ewk_view_setting_font_sans_serif_set(Evas_Object *o, const char *family);
-
-/**
* Queries if the spatial naviagtion feature is enabled.
*
* @param o view object to query if spatial navigation feature is enabled