Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong description of Ref<App> Create() #147

Closed
IanByun opened this issue Aug 12, 2019 · 1 comment
Closed

Wrong description of Ref<App> Create() #147

IanByun opened this issue Aug 12, 2019 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@IanByun
Copy link

IanByun commented Aug 12, 2019

This is copy of ultralight-ux/AppCore#2.

Ref Create() comments say that one should "set your Config before creating App".
https://github.com/ultralight-ux/AppCore/blob/0dfc7936e4ecdce4655b52dfb682ec40c080eb63/include/AppCore/App.h#L51

However, as AppWin::AppWin() constructor overrides with Platform::instance().set_config, it has no effect.
https://github.com/ultralight-ux/AppCore/blob/0dfc7936e4ecdce4655b52dfb682ec40c080eb63/src/win/AppWin.cpp#L23

For example, if I load https://google.co.kr like below,

auto& platform = ultralight::Platform::instance();

Config config;
config.font_family_standard = "Malgun Gothic";
config.font_family_fixed = "Malgun Gothic";
config.font_family_serif = "Malgun Gothic";
config.font_family_sans_serif = "Malgun Gothic";
config.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";

platform.set_config(config);

app_ = App::Create();

The result is like this:
image

The CORRECT way to setup config is,

app_ = App::Create();

auto& platform = ultralight::Platform::instance();

Config config;
config.font_family_standard = "Malgun Gothic";
config.font_family_fixed = "Malgun Gothic";
config.font_family_serif = "Malgun Gothic";
config.font_family_sans_serif = "Malgun Gothic";
config.user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";

platform.set_config(config);

app_->renderer() = Renderer::Create(); //this overides default config with 'my' config

which leads to Chrome-like correctly rendered scene.
image

@adamjs adamjs self-assigned this Sep 27, 2019
@adamjs adamjs added the bug Something isn't working label Sep 27, 2019
@adamjs adamjs added this to the v1.1 milestone Sep 27, 2019
@adamjs
Copy link
Member

adamjs commented Dec 5, 2019

This is fixed in the latest version (1.1), App::Create() now allows you to pass Config and Settings directly.

  /// Create the App singleton.
  ///
  /// @param  settings  Settings to customize App runtime behavior.
  ///
  /// @param  config  Config options for the Ultralight renderer.
  ///
  /// @return  Returns a ref-pointer to the created App instance.
  ///
  /// @note  You should only create one of these per application lifetime.
  ///
  /// @note  Certain Config options may be overridden during App creation,
  ///        most commonly Config::face_winding and Config::device_scale_hint.
  ///
  static Ref<App> Create(Settings settings = Settings(), Config config = Config());

@adamjs adamjs closed this as completed Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants