Bug 46408 - Add C API to WebKit2 for changing the font families
Summary: Add C API to WebKit2 for changing the font families
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P3 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2010-09-23 14:40 PDT by Kenneth Rohde Christiansen
Modified: 2010-09-24 10:59 PDT (History)
8 users (show)

See Also:


Attachments
Patch (11.58 KB, patch)
2010-09-23 14:40 PDT, Kenneth Rohde Christiansen
sam: review-
Details | Formatted Diff | Diff
Patch 2 (11.60 KB, patch)
2010-09-24 07:14 PDT, Kenneth Rohde Christiansen
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Rohde Christiansen 2010-09-23 14:40:19 PDT
Created attachment 68595 [details]
Patch

Patch coming...
Comment 1 Sam Weinig 2010-09-23 23:52:39 PDT
Comment on attachment 68595 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68595&action=review

> WebKit2/UIProcess/API/C/WKPreferences.cpp:160
> +void WKPreferencesSetStandardFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
> +{
> +    toWK(preferencesRef)->setStandardFontFamily(toWTFString(family));
> +}
> +
> +WKStringRef WebPreferencesGetStandardFontFamily(WKPreferencesRef preferencesRef)
> +{
> +    return toCopiedRef(toWK(preferencesRef)->standardFontFamily());
> +}
> +
> +void WKPreferencesSetFixedFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
> +{
> +    toWK(preferencesRef)->setFixedFontFamily(toWTFString(family));
> +}
> +
> +WKStringRef WKPreferencesGetFixedFontFamily(WKPreferencesRef preferencesRef)
> +{
> +    return toCopiedRef(toWK(preferencesRef)->fixedFontFamily());
> +}
> +
> +void WKPreferencesSetSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
> +{
> +    toWK(preferencesRef)->setSerifFontFamily(toWTFString(family));
> +}
> +
> +WKStringRef WKPreferencesGetSerifFontFamily(WKPreferencesRef preferencesRef)
> +{
> +    return toCopiedRef(toWK(preferencesRef)->serifFontFamily());
> +}
> +
> +void WKPreferencesSetSansSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
> +{
> +    toWK(preferencesRef)->setSansSerifFontFamily(toWTFString(family));
> +}
> +
> +WKStringRef WKPreferencesGetSansSerifFontFamily(WKPreferencesRef preferencesRef)
> +{
> +    return toCopiedRef(toWK(preferencesRef)->sansSerifFontFamily());
> +}
> +
> +void WKPreferencesSetCursiveFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
> +{
> +    toWK(preferencesRef)->setCursiveFontFamily(toWTFString(family));
> +}
> +
> +WKStringRef WKPreferencesGetCursiveFontFamily(WKPreferencesRef preferencesRef)
> +{
> +    return toCopiedRef(toWK(preferencesRef)->cursiveFontFamily());
> +}
> +
> +void WKPreferencesSetFantasyFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
> +{
> +    toWK(preferencesRef)->setFantasyFontFamily(toWTFString(family));
> +}
> +
> +WKStringRef WKPreferencesGetFantasyFontFamily(WKPreferencesRef preferencesRef)
> +{
> +    return toCopiedRef(toWK(preferencesRef)->fantasyFontFamily());
> +}

Since all the getters here return copied strings, these need to have the word copy in them instead of get.
Comment 2 Kenneth Rohde Christiansen 2010-09-24 06:48:35 PDT
> > +WKStringRef WKPreferencesGetFantasyFontFamily(WKPreferencesRef preferencesRef)
> > +{
> > +    return toCopiedRef(toWK(preferencesRef)->fantasyFontFamily());
> > +}
> 
> Since all the getters here return copied strings, these need to have the word copy in them instead of get.

Should they be called Copy instead of Get? I see that elsewhere in WebKit2.

Like: WKPreferencesCopyFantasyFontFamily ?
Comment 3 Kenneth Rohde Christiansen 2010-09-24 07:01:06 PDT
(In reply to comment #2)
> > > +WKStringRef WKPreferencesGetFantasyFontFamily(WKPreferencesRef preferencesRef)
> > > +{
> > > +    return toCopiedRef(toWK(preferencesRef)->fantasyFontFamily());
> > > +}
> > 
> > Since all the getters here return copied strings, these need to have the word copy in them instead of get.
> 
> Should they be called Copy instead of Get? I see that elsewhere in WebKit2.
> 
> Like: WKPreferencesCopyFantasyFontFamily ?

I should have read your comment better :-) still waking up.
Comment 4 Kenneth Rohde Christiansen 2010-09-24 07:14:32 PDT
Created attachment 68676 [details]
Patch 2

Change Get to Copy.
Comment 5 Kenneth Rohde Christiansen 2010-09-24 10:58:48 PDT
Landed in 68258