chromium/third_party/blink/public/mojom/android_font_lookup/android_font_lookup.mojom

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module blink.mojom;

import "mojo/public/mojom/base/read_only_file.mojom";

// Interface for renderer to request Android downloaded fonts from font
// providers on-device.
interface AndroidFontLookup {
  // Returns a list of ICU case folded full font names, sorted in ascending
  // lexicographic order, which may be available to be fetched locally from
  // on-device storage.
  [Sync]
  GetUniqueNameLookupTable()
    => (array<string> unique_font_names);

  // Returns an opened read-only File for a font with the given ICU case folded
  // full font name or null if the font is not available. Although the
  // implementation posts to a user-blocking background thread, this interface
  // is synchronous for the renderer to avoid unnecessary re-layout jank.
  // TODO(crbug.com/1270949): This may be able to be removed if
  // FetchAllFontFiles() can be used to get the font file handles.
  [Sync]
  MatchLocalFontByUniqueName(string font_unique_name)
    => (mojo_base.mojom.ReadOnlyFile? font_file_handle);

  // Fetches all available font files and returns a map of ICU case folded full
  // font name to file.
  FetchAllFontFiles()
    => (map<string, mojo_base.mojom.ReadOnlyFile> font_files);
};