Update font settings in api::WebContents
This commit is contained in:
parent
c87fc2426d
commit
816a96c2cc
2 changed files with 18 additions and 19 deletions
|
@ -89,6 +89,11 @@
|
|||
#include "ui/aura/window.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_WIN)
|
||||
#include "content/public/common/renderer_preferences.h"
|
||||
#include "ui/gfx/font_render_params.h"
|
||||
#endif
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
namespace {
|
||||
|
@ -412,6 +417,19 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
|
|||
|
||||
managed_web_contents()->GetView()->SetDelegate(this);
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_WIN)
|
||||
// Update font settings.
|
||||
auto* prefs = web_contents->GetMutableRendererPrefs();
|
||||
CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params,
|
||||
(gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr)));
|
||||
prefs->should_antialias_text = params.antialiasing;
|
||||
prefs->use_subpixel_positioning = params.subpixel_positioning;
|
||||
prefs->hinting = params.hinting;
|
||||
prefs->use_autohinter = params.autohinter;
|
||||
prefs->use_bitmaps = params.use_bitmaps;
|
||||
prefs->subpixel_rendering = params.subpixel_rendering;
|
||||
#endif
|
||||
|
||||
// Save the preferences in C++.
|
||||
new WebContentsPreferences(web_contents, options);
|
||||
|
||||
|
|
|
@ -39,11 +39,6 @@
|
|||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/gfx/geometry/size_conversions.h"
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_WIN)
|
||||
#include "content/public/common/renderer_preferences.h"
|
||||
#include "ui/gfx/font_render_params.h"
|
||||
#endif
|
||||
|
||||
DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::NativeWindowRelay);
|
||||
|
||||
namespace atom {
|
||||
|
@ -72,20 +67,6 @@ NativeWindow::NativeWindow(
|
|||
if (parent)
|
||||
options.Get("modal", &is_modal_);
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_WIN)
|
||||
auto* prefs = web_contents()->GetMutableRendererPrefs();
|
||||
|
||||
// Update font settings.
|
||||
CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params,
|
||||
(gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr)));
|
||||
prefs->should_antialias_text = params.antialiasing;
|
||||
prefs->use_subpixel_positioning = params.subpixel_positioning;
|
||||
prefs->hinting = params.hinting;
|
||||
prefs->use_autohinter = params.autohinter;
|
||||
prefs->use_bitmaps = params.use_bitmaps;
|
||||
prefs->subpixel_rendering = params.subpixel_rendering;
|
||||
#endif
|
||||
|
||||
WindowList::AddWindow(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue