summaryrefslogtreecommitdiff
path: root/vcl/quartz
AgeCommit message (Collapse)Author
2020-01-14tdf#128226: make OpenSymbol font an internal resourceMike Kaganski
OpenSymbol is crucial for Math; so it is not just some font that could be used if present, but part of program resources. As such, it must be available with other program resources, and not depend on user preferences, like uninstallation of the font from system. This patch puts it into program/resource/common/fonts, and adds that path to the paths used for private fonts. This is in addition to share/fonts/truetype, which is optional, and is usually absent on most Linux and Windows installations (on Linux, it is usually in a separate package installing it to system fonts; on Windows, it is also installed to system by MSI). Change-Id: Ibf5e12e70dacb62b965035645fc53e9d83cd8793 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86649 Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Rene Engelhard <rene@debian.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-01-03Avoid -Werror,-Wdeprecated-enum-float-conversionStephan Bergmann
...with Clang 10 trunk: > vcl/quartz/ctfonts.cxx:414:35: error: arithmetic between enumeration type 'FontWeight' and floating-point type 'double' is deprecated [-Werror,-Wdeprecated-enum-float-conversion] > nInt = rint(WEIGHT_NORMAL + fWeight * ((WEIGHT_BLACK - WEIGHT_NORMAL)/0.68)); > ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ etc. These computations had been introduced with ea8422d42e838e7ddfeb8d9f77f3ecedecb29ce8 "Cherry-pick Core Text port from AOO", and it looks like they indeed want to compute a suitable value in the WEIGHT_THIN (=1), ..., WEIGHT_BLACK (=10) range of enum FontWeight, resp. the WIDTH_ULRA_CONDENSED (=1), ..., WIDTH_ULTRA_EXPANDED (=9) range of enum FontWidth (rather than, say, float values in the THIN = 50.0, ..., BLACK = 200.0 constants range of css.awt.FontWeight, resp. the ULTRACONDENSED = 50.0, ..., ULTRAEXPANDED = 200.0 constants range of css.awt.FontWidth). Change-Id: I054e4e215331f84cea03de681aa4b0fb7c12eef5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86176 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-03Avoid -Werror,-Wdeprecated-anon-enum-enum-conversionStephan Bergmann
...with Clang 10 trunk: > vcl/quartz/salgdicommon.cxx:1299:59: error: bitwise operation between different enumeration types ('CGImageAlphaInfo' and '(anonymous enum at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGImage.h:51:9)') is deprecated [-Werror,-Wdeprecated-anon-enum-enum-conversion] > kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big ); > ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~ <https://developer.apple.com/documentation/coregraphics/ 1455939-cgbitmapcontextcreate> documents the "uint32_t bitmapInfo" parameter of CGBitmapContextCreate as: "The constants for specifying the alpha channel information are declared with the CGImageAlphaInfo type but can be passed to this parameter safely. You can also pass the other constants associated with the CGBitmapInfo type." Change-Id: Idee410c65bd022a125a2f5a34cda007a8ca07580 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86175 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-06loplugin:redundantcast (macOS)Stephan Bergmann
Change-Id: Ia514e105d913b8cf77d4fe931deb6b559b3525d3 Reviewed-on: https://gerrit.libreoffice.org/84655 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-12-06loplugin:external (macOS)Stephan Bergmann
* OldEntry in fpicker/source/aqua/resourceprovider.mm was apparently unused ever since it got introduced with 00657aef09d854c74fb426a935a3e8b1fc390bb0 "migrate to boost::gettext" * impl_throwError is used from multiple TU, connectivity/source/drivers/macab/MacabStatement.cxx just missed the relevant #include Change-Id: Iba131da57aa20085bb1c634ba9a3a59566070abd Reviewed-on: https://gerrit.libreoffice.org/84653 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-19tdf#128434 correctly release fonts in destructorsJan-Marek Glogowski
This adds ReleaseFonts() calls to all destructors of SalGraphics and TextRenderImpl derivated classes, which implement SetFont. During destruction a base class can't call into derivated classes, as these are already destructed, so we have to spread these calls manually. Change-Id: Ia57db04f7df665e5205212ce512119e2f60e3379 Reviewed-on: https://gerrit.libreoffice.org/82967 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-11-15loplugin:fakebool and loplugin:consttobool (macOS)Stephan Bergmann
Change-Id: I42d6546a9a400d8edb9ecef82614c6c88d4e6e83 Reviewed-on: https://gerrit.libreoffice.org/82806 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-14Fix method name origin in SAL_WARN_IF(vcl/quartz/salgdi)Julien Nabet
Change-Id: I7fff6af5e521318324df63b32d4be7b0e0f12771 Reviewed-on: https://gerrit.libreoffice.org/80803 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-26remove internal use of 16-bit packed formatsNoel Grandin
none of our supported hardware uses these any more Change-Id: Ic95d6df619a05df0bec1f5870596cb2bb3bcc6cb Reviewed-on: https://gerrit.libreoffice.org/79476 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-23loplugin:fragiledestructor (macOS)Stephan Bergmann
Change-Id: I8ac1f67999ccbb6c411359ac6fd4c473dc339d44 Reviewed-on: https://gerrit.libreoffice.org/79398 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-07remove some unnecessary castsNoel Grandin
Change-Id: I16aa2cdc3e92c3ea2661ebf0a528f72cbe193df9 Reviewed-on: https://gerrit.libreoffice.org/78716 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-28loplugin:returnconstval (macOS)Stephan Bergmann
Remove the spurious "const" that dates back to a poor change in 9177329a425cf70b515d1f266132838894fe54c6 "vcl: FontCharMap to use intrusive_ptr ImplFontCharMap": > --- a/vcl/inc/quartz/salgdi.h > +++ b/vcl/inc/quartz/salgdi.h > @@ -73,7 +73,7 @@ public: > CoreTextStyle* CreateTextStyle( const FontSelectPattern& ) const; > int GetFontTable( const char pTagName[5], unsigned char* ) const; > > - const ImplFontCharMap* GetImplFontCharMap() const; > + const ImplFontCharMapPtr GetImplFontCharMap() const; > bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) > const; > bool HasChar( sal_uInt32 cChar ) const; > Change-Id: I6a533a917ec42513b0783332c35e0a6803504324 Reviewed-on: https://gerrit.libreoffice.org/78235 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-27Consolidate ImplCalcLineSpacing()Khaled Hosny
Move getting UPEM and font tables to the functions and use HarfBuzz API to get them. In the future we might stop reading the tables ourselves and use HarfBuzz metrics API instead. Change-Id: I3f4511628fd33200bae94cdcd96479ba3e6d2fba Reviewed-on: https://gerrit.libreoffice.org/78081 Tested-by: Jenkins Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2019-08-23loplugin:returnconstval in vclNoel Grandin
Change-Id: Id4a0b460ba3c43e80b80ae6e2da9e40a6753e14c Reviewed-on: https://gerrit.libreoffice.org/77965 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-30tdf#62699 Drop (now) pass-through header include/vcl/salbtype.hxxGabor Kelemen
Change-Id: I2e2093ac3c8c6833b70d4932bc12a82a4483bde5 Reviewed-on: https://gerrit.libreoffice.org/76499 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-25tdf#124042: Remove unnecessary code for iOSTor Lillqvist
We don't need to pop the Core Graphics context state stack completely before releasing the context. The code that tried to do that failed anyway when the context was a "foreign" one (from doc_paintWindowDPI() in core's init.cxx) thad had already been released there. Also removed another apparently unnecessary ifndef for iOS. Change-Id: Idcd1e6edd06ab259ec850fd66fcbabc3df0ae3af Reviewed-on: https://gerrit.libreoffice.org/76263 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-16loplugin:simplifyconstruct (macOS)Stephan Bergmann
Change-Id: Ifad405b05142ce61673f22ec3160f50314419ce7 Reviewed-on: https://gerrit.libreoffice.org/75680 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-06Constify GlyphItemJan-Marek Glogowski
This hides all the data, which shouldn't change after init. Real const makes a lot of problems for copying, so this is the 2nd option to just add getters for private data. While at it use typed_flags for the GlyphItemFlags. Change-Id: Ic1eeabe2398f6c30080fdd516285b72c620b11be Reviewed-on: https://gerrit.libreoffice.org/75147 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-06-07Bin the much too verbose SAL_INFO() calls for the "vcl.cg" tagTor Lillqvist
Quikee agreed that they aren't really useful. Doing even the simplest things causes such a huge amount of logging that it is questionable whether anybody could have any use of it. Parts of it might be useful to restore later, if need arises. Like the mnContextStackDepth logging in vcl/inc/quartz/CGHelpers.hxx. Change-Id: If635e6492a50e5955c56c54fa310e7c0ab2986ae Reviewed-on: https://gerrit.libreoffice.org/73639 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <tml@collabora.com>
2019-06-06loplugin:data (macOS)Stephan Bergmann
Change-Id: I404a8364a4c7f8d48533fb3c7757a5b7798de9d8 Reviewed-on: https://gerrit.libreoffice.org/73588 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-06-04tdf#122221: Bin apparently unnecessary early returnTor Lillqvist
Removing these few lines of code fixes the problem on iOS, and has no apparent ill effect on macOS. But sure, I didn't check that thoroughly on macOS, so in case this has a bad effect on macOS after all, need to reinstate the few lines but make them #ifndef IOS. (Still passes make check.) Change-Id: I2380d010ba223a698acfe916fca4580a1502be98
2019-06-02tdf#125506: use rObjectToDevice if neededXisco Fauli
Use same logic as in vcl/unx/generic/gdi/gdiimpl.cxx Regression from 16091ff88aaab9ba9103c4e369bf79b97f431f40 See https://bugs.documentfoundation.org/show_bug.cgi?id=125506#c13 Thanks to Thorsten Wagner for pinpointing Change-Id: I7a7a8c4b3355f5621ba1603939a3757cd03e7777 Reviewed-on: https://gerrit.libreoffice.org/73319 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
2019-05-31tdf#125506 tdf#121241: No need to transform to DeviceCoordinatesXisco Fauli
Regression from b9fa01a8d1137a95af9865a3e47995734c40da6e Change-Id: Ie4ab65966e274bff4d699b7cd4dc0fd47d26c558 Reviewed-on: https://gerrit.libreoffice.org/73249 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-05-22tdf#124271 use the bitmap context, handle scalingTomaž Vajngerl
The problem with latest macOS versions is that creating a graphic context with window (NSGraphicsContext graphicsContextWithWindow:) only works when actually drawing and otherwise it returns null. This caused problems before in AquaVrtualDevice, but we also use this when creating a device backing storage. This interestingly caused slowdowns and eventual crash, but the backtrace looked very misterious as it didn't crash because of a nullptr, but it halted all drawing commands and it crashed because of that. This changes the graphic context with a bitmap context, as it was already done in VirtualDevice and use that instead. The problem with a bitmap context is that we need to handle HiDPI scaling by ourselves now. LayerHolder was extended to store the scaling information of the layer (and its underlaying bitmap context) and provides methods that get the size of the layer in pixels or in scaling independent points (which is just size in pixels multiplied by the scaling factor). An known issue is that VirtualDevice also needs to take scaling into account, which it currently doesn't, so the text is still blurry on a HiDPI screen, but that was already true previously and is something that will be done in a different change. Change-Id: I8e10c518ecba285125746bd20525c4cb5ca67279 Reviewed-on: https://gerrit.libreoffice.org/72663 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-18use CGContextHolder in AquaSalBitmapTomaž Vajngerl
Change-Id: I87f5a1bc2c41c58cff747bbad82867d53ea92ce7 Reviewed-on: https://gerrit.libreoffice.org/72442 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-18use CGContextHolder in copyBitsTomaž Vajngerl
Change-Id: I98f1723da170712e2f2c2a846e02954381376c7e Reviewed-on: https://gerrit.libreoffice.org/72441 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-18use CGContextHolder in AquaVirtualDeviceTomaž Vajngerl
Change-Id: If5e27ea4049a76e560dd9823f335b86e2599d4cc Reviewed-on: https://gerrit.libreoffice.org/72440 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-18Wrap CGLayer into a CGLayerHolder class and move code to use itTomaž Vajngerl
Change-Id: I52539f6582d099ef80048d9a25266c88e1f6d783 Reviewed-on: https://gerrit.libreoffice.org/72439 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-18macOS: store VirtualDevice size in an instance variableTomaž Vajngerl
Change-Id: Id0a7317e9aed4b0222affb7292f6a3a44af74040 Reviewed-on: https://gerrit.libreoffice.org/72438 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-17handle CG state save/restore in ContextHolder classTomaž Vajngerl
Change-Id: I44ee257a8a196e8f2372dd01776c0c7c5193ad0a Reviewed-on: https://gerrit.libreoffice.org/72436 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-17Wrap CGContext into a ContextHolder classTomaž Vajngerl
Change-Id: I3088e0b2f6c54f272fd29d7a6069e8231b207666 Reviewed-on: https://gerrit.libreoffice.org/72435 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-05-13Make BitmapColor inherit from / merge into ColorJan-Marek Glogowski
BitmapColor itself is kept to distingish the Color usage as part of a color palette, which continues to store the offset in the blue value. The original special mbIndex handling is long gone since commit 1fefdd6f3b41 ("Alpha channel in BitmapColor - change bIndex to alpha"), so there is no data difference. This also results in the following changes: * now has a basic_ostream<charT, traits>& operator<< (that was my actual starting point... for an other bug fix) * there is a minimal difference for GetLiminance BGR(29,151,76) => BGR(28,151,77) * no more return values for Merge and Invert (previously returning *this) * replaces all GetBlueOrIndex with GetIndex This leaves one "problematic" part: the GetColorError handling. At first glance it should probably be virtual. The Color variant is less strict then the BitmapColor one - for whatever reason. BitmapColor is always used to search for the best match in a Palette. Currently I'm simply leaving both variants. Would be nice to have an explict for functions here. Change-Id: I251ba3024a1d60f2a9d9fde9cd0a60f08e8322a7 Reviewed-on: https://gerrit.libreoffice.org/72181 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-05-08Add some comments to macOS backend impl. of SalBitmapTomaž Vajngerl
Change-Id: Idfefe7598df0b2e382be84aa5bfc8b60201768a7 Reviewed-on: https://gerrit.libreoffice.org/71991 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-04-21tdf#101854 Move to CommonSalLayout removed faux bold in macosTomaž Vajngerl
Previously faux bold was drawn with setting a dictionary key kCTStrokeWidthAttributeName and a value of the stroke width. This stopped working because we don't use attributedString for drawing anymore but we always use CTFontDrawGlyphs and draw the glyphs, which doesn't have a way to set this attributes. It took me a while to find a workaround (thanks to Apple's great documentation), where we switch text drawing to fill and stroke, and after that we can modify the stroke by changing the line width. Change-Id: I594fcb9c796a9c04ea8234a9938ca2f719706199 Reviewed-on: https://gerrit.libreoffice.org/71012 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-03-15tdf#124042: If mrContext is zero, calling Core Graphics APIs on it is futileTor Lillqvist
If mrContext is zero, the CG calls using it won't do anything and will cause "invalid context" warnings when running under Xcode. So just return early. Such calls to drawPolyPolygon() are apparently not essential but accidental and of no real use. Possibly related to bogus "focus" indicator painting. Which does not make sense on iOS as we aren't drawing to any actual "windows" with "focus". Change-Id: Icc4a768d8b255c09a8972551443ce59f4ad56089
2019-03-08Don'tbuild HarfBuzz with Core Text support on macOS/iOSKhaled Hosny
HarfBuzz 2.x has native support for AAT fonts which is, according to Chrome developers, sgnificantly faster that HarfBuzz Core Text integration. Change-Id: I4d5e861a1958402a6e3ccb720b10f40828c3db6a Reviewed-on: https://gerrit.libreoffice.org/68919 Tested-by: Jenkins Reviewed-by: Khaled Hosny <khaledhosny@eglug.org>
2019-03-08make it possible to use FileDefinitionWidgetDraw in more backendsTomaž Vajngerl
Change-Id: I8871eb49e11d8c72c469230967c3c979091a0f9b Reviewed-on: https://gerrit.libreoffice.org/68898 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2019-02-26sal_uLong->sal_uInt32 in drawEPSNoel Grandin
Change-Id: I58beedfee1a55df971e778ba2aa3b6989ba53663 Reviewed-on: https://gerrit.libreoffice.org/68341 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-08o3tl::make_unique -> std::make_unique in tools..xmloffGabor Kelemen
Since it is now possible to use C++14, it's time to replace the temporary solution with the standard one Change-Id: Ib3201f865d43f372007cdf381c7e244e9cbeae26 Reviewed-on: https://gerrit.libreoffice.org/67474 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-02-01remove unnecessary SAL_WARNNoel Grandin
none of other backends warn about this Change-Id: I9b7ceba413d15698a28806cbb35bd02ccc6e9585 Reviewed-on: https://gerrit.libreoffice.org/67229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-25Assert missing SalGraphics font on GetTextLayoutJan-Marek Glogowski
Trying to layout text without a font can't work. Without a font, currently the text is simply not painted, but this is still a programming error, so warn the developer. And we can get rid of all the intermediate OutputDevice font and gpahics checks, as everything now uses Harfbuzz and there won't be any layout which can't use the cached runs, so just generate them directly. Change-Id: Iae1fab0afeefec1cb1ca82c4e5d8dcbe9919859d Reviewed-on: https://gerrit.libreoffice.org/66818 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-01-25Change SalGraphics::GetTextLayout definitionJan-Marek Glogowski
* drop the unused ImplLayoutArgs argument * return a std::unique_ptr<GenericSalLayout> Change-Id: I150a2a46f67f1ffbbd3ba0ffa68f5bffb30206c8 Reviewed-on: https://gerrit.libreoffice.org/66884 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2018-12-26The macOS+iOS-specific BitmapSystemData::rImageContext was not used anywhereTor Lillqvist
Change-Id: I7190a44d4857fd337fb49e689cd71ffb78b86b9d
2018-12-26Add some pondering about code of questionable provenance in a commentTor Lillqvist
Change-Id: I20b3c8ba0ae4018307a97150440c708cfa3edc40
2018-12-21Bin unnecessary #ifdef, this file is for macOS onlyTor Lillqvist
Change-Id: Ia969648653b71e441446c38c4bed632ff1e53cc6
2018-12-21Add follow-up comment with guess why it must be 96Tor Lillqvist
Change-Id: Ifa725c40c5756ba7999423a782180c1ac3901d30
2018-12-21Add a bit more information to a SAL_WARNTor Lillqvist
Change-Id: Iea825271825119bddfdaa79af3b111659f084d0b
2018-12-11Adapt MACOSX/IOS ifdef for the now constness of the nFlags variableTor Lillqvist
Change-Id: Ic6c51cdc219e663c59dee32f61e337709c90fbd2
2018-12-11Do as the docs say: Use the CGContext property instead of graphicsPortTor Lillqvist
The graphicsPort property of NSGraphicsContext is deprecated in 10.14. CGContext is there since 10.10 so we can use it unconditionally. But sadly this did not enable me to un-comment the assert() a few lines below. Wonder if this deprecation is just a cleanup of the API, and functionality-wise the CGContext property is exactly the same as graphicsPort? Change-Id: I2d5d0c766c343faa2d8cabea3a0729ce5b3a34e3
2018-12-11Comment out an assertion that fails every time for me on macOSTor Lillqvist
Change-Id: I458f44d16b242700b228db647582c4b40b14661a