LCOV - code coverage report
Current view: top level - muse/framework/draw/internal - fontprovider.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 76.5 % 34 26
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2024 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : #include "fontprovider.h"
      23              : 
      24              : #include <memory>
      25              : 
      26              : #include "log.h"
      27              : 
      28              : using namespace muse;
      29              : using namespace muse::draw;
      30              : 
      31            0 : int FontProvider::addSymbolFont(const muse::String& family, const io::path_t& path)
      32              : {
      33            0 :     return fontsDatabase()->addFont(FontDataKey(Font::FontFamily(family)), path);
      34              : }
      35              : 
      36            0 : int FontProvider::addSymbolFont(const muse::String& family, std::shared_ptr<io::IODevice> device)
      37              : {
      38            0 :     return fontsDatabase()->addFont(FontDataKey(Font::FontFamily(family)), std::move(device));
      39              : }
      40              : 
      41            6 : double FontProvider::lineSpacing(const muse::draw::Font& f) const
      42              : {
      43            6 :     return fontsEngine()->lineSpacing(f);
      44              : }
      45              : 
      46            6 : double FontProvider::xHeight(const muse::draw::Font& f) const
      47              : {
      48            6 :     return fontsEngine()->xHeight(f);
      49              : }
      50              : 
      51            6 : double FontProvider::height(const muse::draw::Font& f) const
      52              : {
      53            6 :     return fontsEngine()->height(f);
      54              : }
      55              : 
      56            6 : double FontProvider::ascent(const muse::draw::Font& f) const
      57              : {
      58            6 :     return fontsEngine()->ascent(f);
      59              : }
      60              : 
      61            0 : double FontProvider::capHeight(const muse::draw::Font& f) const
      62              : {
      63            0 :     return fontsEngine()->capHeight(f);
      64              : }
      65              : 
      66            6 : double FontProvider::descent(const muse::draw::Font& f) const
      67              : {
      68            6 :     return fontsEngine()->descent(f);
      69              : }
      70              : 
      71            6 : double FontProvider::underlinePos(const muse::draw::Font& f) const
      72              : {
      73            6 :     return fontsEngine()->underlinePos(f);
      74              : }
      75              : 
      76            6 : double FontProvider::lineWidth(const muse::draw::Font& f) const
      77              : {
      78            6 :     return fontsEngine()->lineWidth(f);
      79              : }
      80              : 
      81            6 : double FontProvider::strikeOutPos(const muse::draw::Font& f) const
      82              : {
      83            6 :     return fontsEngine()->strikeOutPos(f);
      84              : }
      85              : 
      86            0 : bool FontProvider::inFont(const muse::draw::Font& f, char32_t ucs4) const
      87              : {
      88            0 :     return fontsEngine()->inFont(f, ucs4);
      89              : }
      90              : 
      91              : // Text
      92          111 : double FontProvider::horizontalAdvance(const muse::draw::Font& f, const muse::String& string) const
      93              : {
      94          111 :     return fontsEngine()->horizontalAdvance(f, string.toStdU32String());
      95              : }
      96              : 
      97          348 : double FontProvider::horizontalAdvance(const muse::draw::Font& f, char32_t ucs4) const
      98              : {
      99          348 :     return fontsEngine()->horizontalAdvance(f, ucs4);
     100              : }
     101              : 
     102           48 : RectF FontProvider::boundingRect(const muse::draw::Font& f, const muse::String& string) const
     103              : {
     104           48 :     return fontsEngine()->boundingRect(f, string.toStdU32String());
     105              : }
     106              : 
     107          118 : RectF FontProvider::boundingRect(const muse::draw::Font& f, char32_t ucs4) const
     108              : {
     109          118 :     return fontsEngine()->boundingRect(f, ucs4);
     110              : }
     111              : 
     112          112 : RectF FontProvider::tightBoundingRect(const muse::draw::Font& f, const muse::String& string) const
     113              : {
     114          112 :     return fontsEngine()->tightBoundingRect(f, string.toStdU32String());
     115              : }
        

Generated by: LCOV version 2.0-1