summaryrefslogtreecommitdiff
path: root/vcl/win/source/gdi/winlayout.cxx
AgeCommit message (Collapse)AuthorFilesLines
2015-12-02Get rid of a superfluous directory levelTor Lillqvist1-2947/+0
Change-Id: I79e065f0c68b149d2ef69f428d31e36e97a6098b
2015-12-01tdf#95194: We need to set the GF flags in UniscribeLayout::GetNextGlyphs()Tor Lillqvist1-0/+5
The old SimpleWinLayout::GetNextGlyphs() did it. PDFWriterImpl::drawVerticalGlyphs() expects GF_ROTL etc to be set when necessary for vertical text when exporting to PDF. Change-Id: I325d6e9f75a3bc51f24add33dd3bffe7b3c7bee0
2015-11-28Don't wrap glyphy source files in namespace GLyphyDemoStephan Bergmann1-23/+23
...as the source files themselves include standard headers, which must not be included from within a namespace (which confuses clang-cl). According to Tor, the original intent was to try not to pollute the global namespace, but that seems to cause no problems in practice (esp. as nothing from these files gets exported). Change-Id: I204c1db932996a09d16e84dd5c6033caa5362caa
2015-11-28Adapt to true wchar_t in clang-clStephan Bergmann1-1/+1
Change-Id: I1ad03056497f39ca294a8abaffd7e069227a704e
2015-11-28-Werror,-WreorderStephan Bergmann1-2/+2
Change-Id: Ie05ae7b82c59c7ab27f549210ac305e2cd38b68c
2015-11-25Remove code that has been commented out since 2003Tor Lillqvist1-2/+0
Change-Id: I5975af2801560c61ca72ab25f5d1222cf847c4e3
2015-11-24Bin outdated #if and unnecessary <config_mingw.h>Tor Lillqvist1-4/+1
We don't support cross-compiling with MinGW currently, and in any case if we ever attempt such again, in the meantime the free replacement Win32 headers most likely have been updated to include the SCRIPT_CONTROL::fMergeNeutralItems field, so no conditional compilation is needed. Change-Id: I38701d6c41c44952466c1ece7c8433abe67642be
2015-11-20loplugin:sallogareasStephan Bergmann1-1/+1
Change-Id: Ib1f06cb5f925535858bc14aab6f59ad7fd2a3a8d
2015-11-19Make using GLyphy optional at run-timeTor Lillqvist1-22/+406
Change-Id: I7053f16c25f5506d15ebc88f1b0465493dd35077
2015-11-19Use GLyphy for text on Windows (broken)Tor Lillqvist1-308/+191
Work in progress. Produces visible text in some cases, but not nearly all. The text that is visible is roughly in the right place and of the right size, but horribly ugly. Compare to glyphy-demo, which does produce beautiful text, so the problem is not in the GLyphy code but in the way we use it. Include sources from GLyphy's "demo" directory (with only slight modifications to avoid unconditional debug output) and use that "demo" API from vcl. The changes to existing vcl code are all in one place, in the winlayout.cxx file. Change-Id: I69cce5d66db534c6f4c1ab85d520b6090baf8fe0
2015-11-16tdf#94008 Crash opening password protected file - CJK UITakeshi Abe1-1/+1
This fixes a buffer overflow writing over the end of pCaretXArray, which can happen e.g. when drawing mnemonics in the password dialog. Based on a similar calculation of nCurrIdx found in GenericSalLayout::GetCaretPositions(). Change-Id: I7d723cf8cfaeb66f340c7d9ea5b3bc728c6d6209 Reviewed-on: https://gerrit.libreoffice.org/19385 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-11-10tdf#95650: Replace wrong assertion with conditionMike Kaganski1-2/+2
When UniscribeLayout::LayoutText(ImplLayoutArgs & rArgs) is run with BiDiRtl flag, and some skipped VisualItems was reversed in lines 908-927, it's possible that they will arrive in reverse order to the code adjusting mnSubStringMin, so this assertion may fire. This situation is not erroneous, so simply replacing the assert with "if". Change-Id: Icb244502dd00b4c08a2c5192369ee66d743b0dcc Reviewed-on: https://gerrit.libreoffice.org/19835 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2015-10-21tdf#94897: Don't mess up spacing of combining diacritic glyphsTor Lillqvist1-0/+97
At least for the Cambria font, instead of a precombined glyph, Uniscribe ends up using a separate diacritic glyph for some (all?) accented Latin characters. That caused weird layout errors in justified lines when an accented character was followed by space: The diacritic got separated from the base character. Fix that specific case. Be careful not to mess with any other cases. While debugging this I added lots of temporary debugging printouts. Leave some helper functions for that behind, inside #if 0. Maybe we should start collecting such functions, including ones for most common Win32 structs, in some include file in some common location? Change-Id: Ib0198411f820cb8ba8456786869185a43628628c
2015-10-07afl-eventtesting: creating OUString from super long sal_Unicode* is slowCaolán McNamara1-11/+12
the mpStr and mnLength arguments are always created from an OUString and the OUString aRun(rArgs.mpStr); creates a duplicate of the original string. Its way faster to pass the original OUString around instead. Change-Id: I3de0cc31654eb215362548b6aee435f9c0c3c9db Reviewed-on: https://gerrit.libreoffice.org/19221 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-10-01tdf#94428 - don't use OpenGL font rendering when we're printing.Michael Meeks1-1/+1
Change-Id: I212bb442bdffa38d77e7e7357199c39420fa7951
2015-09-29Fix typosAndrea Gelmini1-1/+1
Change-Id: I4525b43fa823d743b86bf4136c56af35274085e6 Reviewed-on: https://gerrit.libreoffice.org/18995 Reviewed-by: Joren De Cuyper <jorendc@libreoffice.org> Tested-by: Joren De Cuyper <jorendc@libreoffice.org>
2015-09-29vcl: oops, fix windows buildMichael Stahl1-1/+1
Change-Id: I73135440321c7c9898f758cb7a921d62f2265bcb
2015-09-29vcl: Vista implies usp10.dll >= 1.600Michael Stahl1-0/+4
... claims https://en.wikipedia.org/wiki/Uniscribe - #ifdef this so it can be removed when dropping XP support. Change-Id: I9a51635cf9bb4876faf6dca011e6da9e1c2dc35d
2015-09-29vcl: remove alloca() in UniscribeLayout::GetCaretPositions()Michael Stahl1-1/+1
Change-Id: I0caab3b69b10aba6a5d45a11f8e9724b4d3c6d83
2015-09-14Refactor graphite integration and update graphiteMartin Hosken1-14/+1
Change-Id: I09db7262c2a6180a078620ba086dd7a4c132bd82 Reviewed-on: https://gerrit.libreoffice.org/18459 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-by: Martin Hosken <martin_hosken@sil.org>
2015-09-07windows opengl: fix CppunitTest_writerperfect_writerMiklos Vajna1-0/+4
Change-Id: I4a7199633d0d940ae009ac144989da7d6c9262ec Reviewed-on: https://gerrit.libreoffice.org/18378 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2015-09-07tdf#93884 windows opengl: make space around cached glyphs depend on font sizeMiklos Vajna1-20/+39
Cached glyphs used to have a 2px border in all font sizes, that's too small for larger fonts. Make the border size depend on the font size for larger fonts to make sure that the rendered glyphs are indeed independent. The introduced GLYPH_SPACE_RATIO = 8 constant is the smallest value where I don't see overflows anymore for large fonts. With this, not even the bugdoc renders correctly when presenting, but also the text is OK when the font size is set to the max allowed by the UI (96pt). Change-Id: I52aa5c4444583fc0467291463697a63f2b8fc86c
2015-09-02tdf#93857 opengl: adapt UniscribeLayout's DrawCachedGlyphs() to FillDXArray()Miklos Vajna1-1/+7
The problem was UniscribeLayout::DrawCachedGlyphs() counted the total advance value unconditionally from mpGlyphAdvances, while UniscribeLayout::FillDXArray() (which provides advance values to e.g. Writer) only used mpGlyphAdvances in case of NULL mpJustifications. Fix this by first checking mpJustifications in UniscribeLayout::DrawCachedGlyphs(), too. With this, e.g. typing "x" in Writer 10 times will not result in a "misplaced" cursor caret. Change-Id: I16c7a258ff77b25c5121b9b974e72ad6efe5e9fc
2015-09-01tdf#93838 windows opengl: fix vertical text position in UniscribeLayoutMiklos Vajna1-3/+3
For one, aPos.Y() is meant to be the baseline position of the text. Based on the MSDN documentation and <https://www-user.tu-chemnitz.de/~ygu/petzold/ch05c.htm>, that means if we want to get top position, we have to only extract tmAscent and not tmInternalLeading. For another, ImplWinFontEntry::AddChunkOfGlyphs() adds a border of 2 pixels both horizontally and vertically, which means that then we need to undo that when counting the vertical position, too. Change-Id: I4ac8e881ea5910662674c2a1b53ece943487ccd9
2015-08-31Compensate for the extra two pixels in ImplWinFontEntry::AddChunkOfGlyphs()Tor Lillqvist1-1/+1
Should do similarly for vertical text, too. Change-Id: I51f5ee3ba1686f151b04f98c43388e0bdfac97fb
2015-08-31vcl: Improve management of mnRef0Count.Jan Holesovsky1-1/+2
Follow-up to 34700400247e378e074ce4164ab2809edb092201; this fixes sw_ww8export unit test on Windows. Change-Id: Ic0c3228efb59a182e1562b73117418cd8b5e6017
2015-08-30Don't check SAL_DETAIL_ENABLE_LOG_INFO, check SAL_LOG_INFOTor Lillqvist1-3/+3
SAL_DETAIL_ENABLE_LOG_INFO is always defined, as "true" or "false". It is SAL_LOG_INFO that is defined or not, and can be used to avoid unnecessary non-trivial code that the compiler might not be able to optimise away. Change-Id: I9903faab64b39fee86bff3b085cdce3614b0d921
2015-08-29WaE: 'rChunk' : unreferenced formal parameterTor Lillqvist1-2/+2
Change-Id: I1491ea35af3b8237a9b8f6357e6452b323139e99
2015-08-29Avoid unintended unconditional std::cerr debug outputTor Lillqvist1-22/+21
Can't call a function that as a side effect prints to std::cerr in SAL_INFO. It will be called even if the log area doesn't match $SAL_LOG. Just use only SAL_INFO and no plain std::cerr output. It's fine to output a string with embedded newlines in SAL_INFO. Also drop the debug output line with the glyph start positions, it was less than useful. Change-Id: I9fb5ed068aae1b835e20cf1ec1097bcd55deb05d
2015-08-28vcl: fix resource management issue in WinSalLayoutMichael Stahl1-1/+9
Since commit 65a66d41fd0e13d0aad9df935091b731b4af650a the sd_exports_test crashes on Windows in UniscribeLayout because it uses a ImplFontEntry that has been removed from the font cache. Tweak the refcount in WinLayout so it will be valid. Change-Id: Ic4bf984ea9fd70de9fa95ca964ae12d95d47d5bf
2015-08-28Avoid accidental leftover unconditional debug printoutTor Lillqvist1-2/+3
Change-Id: I67d2430aec782efa7916856584028f469d39355c
2015-08-28vcl: convert to assert in UniscribeLayout::DropGlyph()Michael Stahl1-2/+2
Change-Id: I918a47da16a539f981baa9a8c1e5a7a5cf642cf4
2015-08-28vcl: fix drmemory warning in UniscribeLayout::DropGlyph()Michael Stahl1-1/+1
It says there's access to uninitialized variable on that line, so propbably the loop is running over. Change-Id: I0226f82b20a6fbbc79af5bbb46af09830c3bc25a
2015-08-25Turn on glyph caching by default when using OpenGLTor Lillqvist1-1/+1
Can now be turned off with a SAL_DISABLE_GLYPH_CACHING environment variable. Change-Id: I7ac14d72dc0f85c0682d92492eb96bec1d207609
2015-08-24Don't attempt to cache glyphs that are vertical but the text direction isn'tTor Lillqvist1-0/+3
That is a too complex and rare case to bother with, I think. Change-Id: Ica6ef7fa05314d2367dcff32627c1aec6ba8f8df
2015-08-21Let's not overdo the verboseness in this SAL_INFOTor Lillqvist1-49/+1
Change-Id: I7b06d0ffe53c6ebf2b479951321dcb37cb22c355
2015-08-21Error handlingTor Lillqvist1-2/+32
Change-Id: I46e5463aaa5cab41cd69c13314ee98a0c73e7ba2
2015-08-21Make vertical fonts show up when using OpenGL glyph cachingTor Lillqvist1-28/+118
Change-Id: I6b19873eef48b625dc3d4f7b3a9afdb348189b38
2015-08-20Adjust for the TA_BASELINE of the DCTor Lillqvist1-1/+6
The text alignment of DCs is set to TA_BASELINE in WinSalGraphics::InitGraphics(). In the ScriptTextOut-using old code path this affects where glyphs are put, so we need to take it into consideration also in the new code path that uses cached glyph textures. Adjusting the position up by the ascent plus internal leading of the font seems to work at least for horizontal scripts. (We used to bluntly adjust the position up by the height of the glyph cache texture, which was too much. The glyphs got positioned too high and the top of tall ones was clipped.) Change-Id: I86aecd6f3016e14b2f0328555ddfd3129e394c4c
2015-08-20Drop code that is dead after 4667db065d34193d99bce82f7e8f3b20a03ecadeTor Lillqvist1-42/+0
Change-Id: Id023b43e901b0e41ebf3b208c6e80fd023bf7f9a
2015-08-19Still more hacking on OpenGL glyph caching for WindowsTor Lillqvist1-10/+45
Show the whole height of the cache bitmap after all (when SAL_LOG contains vcl.gdi.opengl). The interesting pieces are often at the bottom, like the tip of the hook of the "j" glyphs that used to bleed over into the preceding glyphs, usually "i", when they were rendered into the same chunk. Add more space between glyphs and at top and bottom of the bitmap, for anti-aliasing. The glyph ABC widths don't take expansions caused by anti-aliasing into consideration and are misleading. Hopefully anti-aliasing can expand the (partially) painted pixels of a glyph just one column/row in each direction, but for safety use a two-pixel border. (Defensive programming, eek?) Some getWidth() instead of GetWidth() etc craziness. Using <tools/gen.hxx> types truly is programming-by-coincidence as Thorsten says. In a dbgutil build, setting the environment variable VCL_GLYPH_CACHING_HACK_NO_ANTIALIAS causes the code to turn off anti-aliasing for the fonts used. I used this to verify that it indeed was anti-aliasing that made the ABC widths inconsistent with reality. Not sure if it makes sense to keep this code in? Anyway, now I don't see any leaked pixels in "i" glyphs any more, touch wood. Change-Id: If527343ff1dcdb1fa208cd5e7fa4d08f812d0d7b
2015-08-19Make the pixel greylevel debug output work as intendedTor Lillqvist1-1/+4
Change-Id: I29cb771eb059f560b7cbd449257ffda581b40f11
2015-08-19More hacks to glyph rendering for caching with OpenGL on WindowsTor Lillqvist1-2/+11
Change-Id: I934ad7453f35909f4c3ad999e33453b5b6032480
2015-08-19More hacking on OpenGL glyph caching on WindowsTor Lillqvist1-18/+23
Now text looks better, for instance the lower-case "t" glyphs on the Start Centre aren't totally weird any more. But for instance the tip of the hook of "j" leaks into the "i" texture. I guess I really would need to render glyphs one by one. Change-Id: I69ae2d2f7c559530bcfdfc1a4915503fcb3ab4af
2015-08-19Add FIXME comment and bin an #if 0 snippetTor Lillqvist1-10/+2
Change-Id: I0bbea4ef62c8e94d8b8f1bfb440712da5839e532
2015-08-19Initial hack for OpenGL glyph caching on WindowsTor Lillqvist1-0/+341
Shows text roughly correctly, but many problems. Conditional at run-time on the SAL_ENABLE_GLYPH_CACHING environment variable in addition to SAL_FORCEGL. One obvious thing that needs fixing is making sure that the glyphs are rendered into the texture without overlap. Compensating negative values in the ABC::abcA and ABC::abdC width is not enough. Also, the cache should be changed to actually have "cache" functionality, i.e. entries should expire based on some criterion. Change-Id: I66a37d3354a09011a654f15a7d2bd8efaa14ad1e
2015-08-12WaE: 'rArgs' : unreferenced formal parameterTor Lillqvist1-1/+1
Change-Id: Ia41882a4d33e7b148044801902517b2b034d3ee4
2015-08-12Drop SimpleWinLayoutTor Lillqvist1-729/+20
Use Uniscribe also for non-complex text. It is complicated enough to have separate Graphite and Uniscribe layout engines. Will make further changes to the code easier to manage, especially as with the UniscribeLayout code we have access to the actual glyphs. (Cf. 3e47219e06b9a279ba22a9bbef668731f2d3e07d) Change-Id: I9c67c172fe3e3d26d1c6cb1c0b7f1516b0b87f12
2015-08-10SimpleWinLayout::mbDisableGlyphs was always trueTor Lillqvist1-38/+14
Remove dead code. Should have no effect on behaviour. Possibly originally the intent was that mbDisableGlyphs would have been false in most cases on NT-based Windows (all versions that we support now). However, since dadfc60873d4dce4e0c46e1d3405f8d45535cdcf, in 2005, mbDisableGlyphs was set to always true in the SimpleWinLayout ctor. Change-Id: Id929224d5656706762c2f44ee26c76f8b20ee8b8
2015-08-10Avoid some ugly and pointless initial double colonsTor Lillqvist1-36/+36
Change-Id: I0d0cb1ef1e7b7f4747204b84c7c910f174e9c7b5