fontconfig_matching.h 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SERVICES_FONT_FONTCONFIG_MATCHING_H_
  5. #define COMPONENTS_SERVICES_FONT_FONTCONFIG_MATCHING_H_
  6. #include "base/files/file_path.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace font_service {
  9. // Searches FontConfig for a system font uniquely identified by full font name
  10. // or postscript name. The matching algorithm tries to match both. Used for
  11. // matching @font-face { src: local() } references in Blink.
  12. class FontConfigLocalMatching {
  13. public:
  14. struct FontConfigMatchResult {
  15. base::FilePath file_path;
  16. unsigned ttc_index;
  17. };
  18. static absl::optional<FontConfigMatchResult>
  19. FindFontByPostscriptNameOrFullFontName(const std::string& font_name);
  20. private:
  21. static absl::optional<FontConfigMatchResult> FindFontBySpecifiedName(
  22. const char* fontconfig_parameter_name,
  23. const std::string& font_name);
  24. };
  25. } // namespace font_service
  26. #endif // COMPONENTS_SERVICES_FONT_FONTCONFIG_MATCHING_H_