aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx/platform/mod.rs
Commit message (Collapse)AuthorAgeFilesLines
* Rename `gfx` to `fonts` (#32556)Martin Robinson2024-06-191-298/+0
| | | | | | | | | This crate only takes care of fonts now as graphics related things are split into other crates. In addition, this exposes data structures at the top of the crate, hiding the implementation details and making it simpler to import them. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* build: Fix build warnings on Windows (#32500)Martin Robinson2024-06-151-0/+3
| | | | | Disable some code for Windows, which is causing build warnings. When it cannot be easily disabled (mainly for the incomplete BHM and sandbox feature), allow dead code.
* fonts: Merge Noto fallback lists (#32463)Martin Robinson2024-06-131-0/+236
| | | | | On platforms that ship Noto, the list of fallback fonts can be shared. This reduces code duplcation and makes it easier to keep up to date with changes in Noto.
* Add font-fallback on OpenHarmony and fix several compilation issues (#32141)Jonathan Schwender2024-05-021-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add OpenHarmony support for allocator / profile Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * gfx: Build harfbuzz from source on OHOS Updates `freetype-sys` to v0.20.1, which includes a build fix for OpenHarmony. Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * gfx: Don't depend on fontconfig on OpenHarmony Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * gfx: Add ohos font fallback Hardcode HarmonyOS_Sans_SC_Regular for Chinese Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * libservo: OHOS useragent, and explicitly opt out of sandboxing Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> * libservo: Disable get_native_media_display_and_gl_context on ohos Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com> --------- Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
* fonts: Rework platform font initialization (#32127)Mukilan Thiyagarajan2024-04-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change reworks the way that platform fonts are created and descriptor data is on `FontTemplate` is initialized. The main change here is that platform fonts for local font faces are always initialized using the font data loaded into memory from disk. This means that there is now only a single path for creating platform fonts. In addition, the font list is now responsible for getting the `FontTemplateDescriptor` for local `FontTemplate`s. Before the font had to be loaded into memory to get the weight, style, and width used for the descriptor. This is what fonts lists are for though, so for every platform we have that information before needing to load the font. In the future, hopefully this will allow discarding fonts before needing to load them into memory. Web fonts still get the descriptor from the platform handle, but hopefully that can be done with skrifa in the future. Thsese two fixes together allow properly loading indexed font variations on Linux machines. Before only the first variation could be instantiated. Fixes https://github.com/servo/servo/issues/13317. Fixes https://github.com/servo/servo/issues/24554. Co-authored-by: Martin Robinson <mrobinson@igalia.com> ---- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #13317 and #24554 - [x] There are tests for these changes --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* gfx: Remove `FontTemplateData` (#32034)Martin Robinson2024-04-161-4/+2
| | | | | | | | | | | | | | | | | | | Now that `FontTemplateData` is more or less the same on all platforms, it can be removed. This is a preparatory change for a full refactor of the font system on Servo. The major changes here are: - Remove `FontTemplateData` and move its members into `FontTemplate` - Make `FontTemplate` have full interior mutability instead of only the `FontTemplateData` member. This is preparation for having these data types `Send` and `Sync` with locking. - Remove the strong/weak reference concept for font data. In practice, all font data references were strong, so this was never fully complete. Instead of using this approach, the new font system will use a central font data cache with references associated to layouts. - The `CTFont` cache is now a global cache, so `CTFont`s can be shared between threads. The cache is cleared when clearing font caches. A benefit of this change (apart from `CTFont` sharing) is that font data loading is platform-independent now.
* Remove `FontContextHandle` (#32038)Martin Robinson2024-04-121-9/+4
| | | | | | | | | | | | | | | | | | | | | | | The `FontContextHandle` was really only used on FreeType platforms to store the `FT_Library` handle to use for creating faces. Each `FontContext` and `FontCacheThread` would create its own `FontContextHandle`. This change removes this data structure in favor of a mutex-protected shared `FontContextHandle` for an entire Servo process. The handle is initialized using a `OnceLock` to ensure that it only happens once and also that it stays alive for the entire process lifetime. In addition to greatly simplifying the code, this will make it possible for different threads to share platform-specific `FontHandle`s, avoiding multiple allocations for a single font. The only downside to all of this is that memory usage of FreeType fonts isn't measured (though the mechanism is still there). This is because the `FontCacheThread` currently doesn't do any memory measurement. Eventually this *will* happen though, during the font system redesign. In exchange, this should reduce the memory usage since there is only a single FreeType library loaded into memory now. This is part of #32033.
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-6/+4
| | | | | * strict imports formatting * Reformat all imports
* Use xml-rs instead of rcdom for Android font list parsingSimon Sapin2019-10-231-0/+1
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* `cargo fix --edition`Simon Sapin2018-11-061-4/+4
|
* Format gfx platform #21373kingdido9992018-09-051-1/+3
|
* Ged rid of libfontconfig in Android. Query available fonts from Android ↵Imanol Fernandez2017-06-021-1/+7
| | | | system font configuration files.
* DirectWrite font backend for WindowsVladimir Vukicevic2016-11-101-3/+5
|
* Minimal Win32 font platform implementation.Glenn Watson2016-10-051-10/+15
| | | | | | | | | | | This uses a (very simple) Win32 API call to enumerate font families available, and load them as byte buffers. The font rasterization itself is done by freetype. This gets Servo + WR + Windows working, but should be improved by adding a proper implementation that matches fonts correctly and also uses DirectWrite (or GDI) to handle font rasterization.
* Native MSVC windows build, convert to cmakeVladimir Vukicevic2016-08-171-2/+13
|
* Make the gfx::platform module private.Ms2ger2016-06-051-2/+2
|
* Move c_str_to_string to its only consumer.Ms2ger2016-06-051-0/+10
|
* win32: use fontconfig/freetype on windows as well (for now)Vladimir Vukicevic2016-01-201-2/+2
|
* make test-tidy check that = have space after themerneyja2015-09-011-4/+4
|
* Rust upgrade to rustc hash b03a2755193cd756583bcf5831cf4545d75ecb8aJack Moffitt2014-11-131-4/+2
|
* Cargoify servoJack Moffitt2014-09-081-0/+27