/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// tdf#148470 remove the resolved chars from rMissing to flag which ones are still missing // for an attempt with another font
OUStringBuffer aStillMissingChars; for (sal_Int32 nStrIndex = 0; nStrIndex < rMissingChars.getLength();)
{
sal_Int32 nOldStrIndex = nStrIndex;
rMissingChars.iterateCodePoints(&nStrIndex);
sal_Int32 nCharLength = nStrIndex - nOldStrIndex; if (!FontHasCharacter(pFallback, rMissingChars, nOldStrIndex, nCharLength))
aStillMissingChars.append(rMissingChars.getStr() + nOldStrIndex, nCharLength);
}
rMissingChars = aStillMissingChars.toString();
#if HAVE_FEATURE_SKIA // tdf#146842 Do not use Skia for printing // Skia does not work with a native print graphics contexts. I am not sure // why but from what I can see, the Skia implementation drawing to a bitmap // buffer. However, in an NSPrintOperation, the print view's backing buffer // is CGPDFContext so even if this bug could be solved by blitting the // Skia bitmap buffer, the printed PDF would not have selectable text so // always disable Skia for print graphics contexts. if(!bPrinter && SkiaHelper::isVCLSkiaEnabled())
mpBackend.reset(new AquaSkiaSalGraphicsImpl(*this, maShared)); else
mpBackend.reset(new AquaGraphicsBackend(maShared)); #else
(void)bPrinter;
mpBackend.reset(new AquaGraphicsBackend(maShared)); #endif
for (int i = 0; i < MAX_FALLBACK; ++i)
mpFont[i] = nullptr;
if (comphelper::LibreOfficeKit::isActive())
initWidgetDrawBackends(true);
}
AquaSalGraphics::~AquaSalGraphics()
{
SAL_INFO( "vcl.quartz", "AquaSalGraphics::~AquaSalGraphics() this=" << this );
maShared.unsetClipPath();
ReleaseFonts();
maShared.mpXorEmulation.reset();
#ifdef IOS if (maShared.mbForeignContext) return; #endif if (maShared.maLayer.isSet())
{
CGLayerRelease(maShared.maLayer.get());
} elseif (maShared.maContextHolder.isSet() #ifdef MACOSX
&& maShared.mbWindow #endif
)
{ // destroy backbuffer bitmap context that we created ourself
CGContextRelease(maShared.maContextHolder.get());
maShared.maContextHolder.set(nullptr);
}
}
CFErrorRef error; bool success = CTFontManagerRegisterFontsForURL(rFontURL, kCTFontManagerScopeProcess, &error); if (success)
{ // tdf155212 clear the cached system font list after loading a font // If the system font is not cached in SalData, loading embedded // fonts will be extremely slow and will trigger each frame and each // of its internal subframes to reload the system font list when // loading documents with embedded fonts. // So instead, reenable caching of the system font list in SalData // by reverting commit 3b6e9582ce43242a2304047561116bb26808408b. // Then, to prevent tdf#72456 from reoccurring, clear the cached // system font list after a font has been loaded or unloaded. // This should cause the first frame's request to reload the cached // system font list and all subsequent frames will avoid doing // duplicate font reloads.
SalData* pSalData = GetSalData();
pSalData->mpFontList.reset();
} else
{
CFRelease(error);
}
CFRelease(rFontPath);
CFRelease(rFontURL);
// internal font resources, required for normal operation, like OpenSymbol
AddTempFontDir( aBrandStr + "/" LIBO_SHARE_RESOURCE_FOLDER "/common/fonts/" );
// The idea is to cache the list of system fonts once it has been generated. // SalData seems to be a good place for this caching. However we have to // carefully make the access to the font list thread-safe. If we register // a font-change event handler to update the font list in case fonts have // changed on the system we have to lock access to the list. The right // way to do that is the solar mutex since GetDevFontList is protected // through it as should be all event handlers
// Related tdf#155212: the system font list needs to be cached but that // should not cause tdf#72456 to reoccur now that the cached system font // is cleared immediately after a font has been loaded
SalData* pSalData = GetSalData(); if( !pSalData->mpFontList )
pSalData->mpFontList = GetCoretextFontList();
// Copy all PhysicalFontFace objects contained in the SystemFontList
pSalData->mpFontList->AnnounceFonts( *pFontCollection );
// Whether the glyph should be upright in vertical mode or not bool bUprightGlyph = false;
if (rFont.mfFontRotation)
{ if (pGlyph->IsVertical())
bUprightGlyph = true; else // Transform the position of rotated glyphs.
aGCPos = CGPointApplyAffineTransform(aGCPos, aRotMatrix);
}
// The view is vertically flipped (no idea why), flip it back.
CGContextScaleCTM(mrShared.maContextHolder.get(), 1.0, -1.0);
CGContextSetShouldAntialias(mrShared.maContextHolder.get(), !mrShared.mbNonAntialiasedText);
CGContextSetFillColor(mrShared.maContextHolder.get(), textColor.AsArray());
auto aIt = aGlyphOrientation.cbegin(); while (aIt != aGlyphOrientation.cend())
{ bool bUprightGlyph = *aIt; // Find the boundary of the run of glyphs with the same rotation, to be // drawn together. auto aNext = std::find(aIt, aGlyphOrientation.cend(), !bUprightGlyph);
size_t nStartIndex = std::distance(aGlyphOrientation.cbegin(), aIt);
size_t nLen = std::distance(aIt, aNext);
void AquaSalGraphics::SetFont(LogicalFontInstance* pReqFont, int nFallbackLevel)
{ // release the font for (int i = nFallbackLevel; i < MAX_FALLBACK; ++i)
{ if (!mpFont[i]) break;
mpFont[i].clear();
}
if (!pReqFont) return;
// update the font
mpFont[nFallbackLevel] = static_cast<CoreTextFont*>(pReqFont);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.