Changes between Version 1 and Version 2 of WK2-EFLTextCheckerApiTutorial


Ignore:
Timestamp:
Jan 11, 2013 1:39:49 AM (9 years ago)
Author:
g.czajkowski@samsung.com
Comment:

apply Michal's Roj comments

Legend:

Unmodified
Added
Removed
Modified
  • WK2-EFLTextCheckerApiTutorial

    v1 v2  
     1== Abstract ==
     2The tutorial shows the text checker API and its usage, it describes:
     3* functions provided by the text checker feature,
     4* how to enable the feature,
     5* how to set languages to be used in spell checking,
     6* how to to be notified on the text checker settings change,
     7* how to override the default text checker implementation.
     8
    19== Introduction ==
    210
    3 Text Checker feature allows to check spelling in the editable areas for example, input fields, text areas and content editable. Functions:
    4  * check spelling of text (while typing to the input element),
    5  * get suggestions for the misspelled word (through the context menu),
    6  * learn/ignore the misspelled word (through the context menu).
    7 There is one text checker object per application and it's disabled by default.
     11Text Checker feature allows to check spelling in the editable areas (such ad input fields, text areas and content editable). Functions provided by the text checker feature are as follows:
     12 * check if spelling of text is correct (while typing the input text),
     13 * get suggestions for the misspelled word (this is made through feature available in the context menu),
     14 * learn/ignore the misspelled word (through the feature available in context menu).
     15The feature is available for [http://trac.webkit.org/wiki/EFLWebKit EFL's WebKit2 port]. There is one text checker object per application and it's disabled by default. The text checker feature is language-neutral. However, relevant dictionaries should be set to perform spelling.
    816
    917== Enabling text checker feature ==
    1018
    11 If application wants to use the feature, API from ewk_settings.h should be used:
     19If an application wants to use this feature, the following API from ewk_settings.h should be used:
     20{{{
     21void ewk_settings_continuous_spell_checking_enabled_set(Eina_Bool enable);
     22}}}
     23Here is an example how an application can enable this feature:
    1224{{{
    1325ewk_settings_continuous_spell_checking_enabled_set(EINA_TRUE);
    1426}}}
     27As a result, the text checker feature is enabled and the spell checking related functionalities are available for the user.
    1528
    16 The client is able to query whether spellchecker continuous spell checking is enabled. Here is an example:
     29
     30
     31The user is able to query whether spellchecker continuous spell checking is enabled, the following API from ewk_settings.h should be used:
     32{{{
     33Eina_Bool ewk_settings_continuous_spell_checking_enabled_get(void);
     34}}}
     35Here is an example of its usage:
    1736{{{
    1837Eina_Bool enabled = ewk_settings_continuous_spell_checking_enabled_get();
     
    2039   
    2140== Languages support ==
    22 By default, WebKit2-EFL performs spell checking based on the default OS language. If the client prefers to use a specific language, he has an opportunity to change it by following API:
     41By default, WebKit2-EFL performs spell checking based on the default OS language. An arbitrary language can be set by using the following API from the ewk_settings.h:
     42{{{
     43void ewk_settings_spell_checking_languages_set(const char *languages);
     44}}}
     45
     46The example below sets English languages (US version) that will be used to perform spell checking.
    2347{{{
    2448const char lang[] = "en_US";
     
    2650}}}
    2751
    28 The client is able to verify the typed text with multi languages support. The languages that are involved in spell checking can be given with comma separated values. Here is an example:
     52The user is able to verify the typed text with multi languages support. The languages to be used in spell checking can be given as comma separated strings. Here is an example:
    2953{{{
    3054const char langs[] = "en_US,ko,pl";
    3155ewk_settings_spell_checking_languages_set(langs);
    3256}}}
     57The presented example sets three languages (English, Korean and Polish) to be used in spell checking. The number of the languages is not limited. However, be aware that loading multiple dictionaries may slow down your application.[[BR]]
    3358
    34 The number of the languages is not limited. But please be aware that loading multiple dictionaries may slow down your application.
    35 There is a possibility to retrieve a list of dictionaries that are supported/installed by OS. Here is an example:
     59There is a possibility to retrieve a list of dictionaries that are supported/installed by OS. The following API from ewk_settings.h should be used:
     60{{{
     61Eina_List *ewk_settings_spell_checking_available_languages_get(void);
     62}}}
     63
     64Here is an example of its usage. It gets the available languages and displays them on the standard output:
    3665{{{
    3766Eina_List *available_langs = ewk_settings_spell_checking_available_languages_get();
     
    6291   printf("%s\n", (const char*) dict);
    6392}}}
    64 
    65 The client is responsible for destroying the list and its items after use. Here is an example:
     93The presented example gets the languages that are in use and displays them on the standard output. The client is responsible for destroying the list and its items after use. Here is an example:
    6694{{{
    6795EINA_LIST_FREE(loaded_langs, dict)
     
    7199== Notification about setting change ==
    72100
    73 There is a callback function used to notify the client when the continuous spell checking setting was changed by WebKit. Specifying of this callback is needed if the application wants to receive notifications once WebKit changes this setting. If the application is not interested, this callback is not set. Changing of this setting at the WebKit level can be made as a result of modifying options in a Context Menu by a user. Here is an example:
     101There is a callback function used to notify the user when the continuous spell checking setting was changed by WebKit. Specifying of this callback is needed if the application wants to receive notifications once WebKit changes this setting. If the application is not interested, this callback is not set. Changing of this setting at the WebKit level can be made as a result of modifying options in a Context Menu by a user. The following API from ewk_settings.h can be used:
     102{{{
     103void ewk_settings_continuous_spell_checking_change_cb_set(Ewk_Settings_Continuous_Spell_Checking_Change_Cb cb);
     104typedef void (*Ewk_Settings_Continuous_Spell_Checking_Change_Cb)(Eina_Bool enable);
     105}}}
    74106
    75 
     107The presented example registers the callback and displays a message with a new value of the continuous spell checking:
    76108{{{
    77109// Callback definition.
     
    87119}}}
    88120
    89 == Overwrite the default text checker implementation by the client ==
     121== Overdrive the default text checker implementation by the client ==
    90122
    91 The default WebKit text checker implementation is based on the Enchant library (http://www.abisource.com/projects/enchant/). It doesn't ensure grammar checking. Application is able to overwrite it by defining its own implementation and setting appropriate callback functions. To overwrite the default text checker implementation API from ewk_text_checker.h can be used.
    92 Here is an example of overwriting the implementation of check spelling of the given text:
     123The default WebKit text checker implementation is based on the [http://www.abisource.com/projects/enchant/ Enchant] library. It doesn't ensure grammar checking. The application is able to override it by defining its own implementation and setting appropriate callback functions. To override the default text checker implementation API from ewk_text_checker.h can be used:
     124{{{
     125void ewk_text_checker_string_spelling_check_cb_set(Ewk_Text_Checker_String_Spelling_Check_Cb cb);
     126typedef void (*Ewk_Text_Checker_String_Spelling_Check_Cb)(uint64_t tag, const char *text, int32_t *misspelling_location, int32_t *misspelling_length);
     127}}}
     128
     129Here is an example of overriding the implementation of check spelling of the given text:
    93130{{{
    94131// Callback definition.
     
    107144}}}
    108145
    109 More examples of overwriting the text checker implementation can be found at https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp
     146More examples of overwriting the text checker implementation can be found [https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp here].
    110147
    111148==  More detailed information ==
    112 You can find the unit tests of text checker API here: https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp.
     149You can find the unit tests of text checker API [https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp here]. There are more test cases and examples of the API usage. WebKit-EFL's bots are building and testing text checker API. You can check their results [http://build.webkit.org/console?category=EFL here].
    113150
    114 There are more test cases and examples of usage. WebKit-EFL's bots are building and testing text checker API. You can check their results here: http://build.webkit.org/console?category=EFL
    115 
    116 Text checker documentation and its API can be found at:
    117  * ewk_text_checker.h (https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.h)
    118  * ewk_settings.h (https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.h)
     151The text checker documentation and its API can be found at:
     152 * [https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.h ewk_settings.h],
     153 * [https://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.h ewk_text_checker.h].
    119154
    120155== Help, issues ==
     
    122157For issues with the text checker, please contact:
    123158 * Grzegorz Czajkowski - g.czajkowski (at) samsung.com
    124  * Michal Roj (m.roj (at) samsung.com
     159 * Michal Roj - m.roj (at) samsung.com