diff options
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src')
5 files changed, 45 insertions, 64 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp index 1c41c22a5db..68ff97508af 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/HyperlinkManager.cpp @@ -182,10 +182,10 @@ void HyperlinkManager::markLinkedBox (SpecialActions &actions) { actions.prependToPage(std::move(rect)); if (MARKER_TYPE == MarkerType::BOX || MARKER_TYPE == MarkerType::BGCOLOR) { // slightly enlarge the boxed area - x -= linewidth; - y -= linewidth; - w += 2*linewidth; - h += 2*linewidth; + x -= linewidth/2; + y -= linewidth/2; + w += linewidth; + h += linewidth; } actions.embed(BoundingBox(x, y, x+w, y+h)); } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp index efe5835981e..8075f14c8ac 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.cpp @@ -65,7 +65,10 @@ void PSPreviewFilter::execute (const char *code, size_t len) { else { // Read bounding box information pushed on the operand stack by the preview package. // It consists of 7 values in DVI units: - // llx, lly, urx, ury, height, depth, width + // adj_left, adj_bottom, adj_right, adj_top, height, depth, width, + // where the first 4 values are set by \PreviewBorder or \PreviewBbAdjust. They denote + // the border adjustments to create additional space around the graphics. + // The baseline of the tight box extends from (0,0) to (tight_width, 0). CharInputBuffer ib(code, len); BufferInputReader ir(ib); ir.skipSpace(); @@ -83,34 +86,21 @@ void PSPreviewFilter::execute (const char *code, size_t len) { bool PSPreviewFilter::getBoundingBox (BoundingBox &bbox) const { if (_boxExtents.size() < 7) return false; - double left = -_boxExtents[0]*_dvi2bp; - bbox = BoundingBox(-left, -height(), width()-left, depth()); - return true; -} - - -/** Gets the 4 border position values set by the preview package (in bp units). - * @return true if the border data is available */ -bool PSPreviewFilter::getBorders (double &left, double &right, double &top, double &bottom) const { - if (_boxExtents.size() < 4) - return false; - left = -_boxExtents[0]*_dvi2bp; - top = -_boxExtents[1]*_dvi2bp; - right = _boxExtents[2]*_dvi2bp; - bottom = _boxExtents[3]*_dvi2bp; + const double leftX = _boxExtents[0]*_dvi2bp; + bbox = BoundingBox(leftX, -height(), width()+leftX, depth()); return true; } /** Returns the box height in PS points, or -1 if no data was found or read yet. */ double PSPreviewFilter::height () const { - return _boxExtents.size() > 4 ? (_boxExtents[4]-_boxExtents[1])*_dvi2bp : -1; + return _boxExtents.size() > 4 ? (_boxExtents[4]+_boxExtents[3])*_dvi2bp : -1; } /** Returns the box depth in PS points, or -1 if no data was found or read yet. */ double PSPreviewFilter::depth () const { - return _boxExtents.size() > 5 ? (_boxExtents[5]+_boxExtents[3])*_dvi2bp : -1; + return _boxExtents.size() > 5 ? (_boxExtents[5]-_boxExtents[1])*_dvi2bp : -1; } diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp index 62a40699145..7a6e436b8aa 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PSPreviewFilter.hpp @@ -28,8 +28,7 @@ class SpecialActions; -class PSPreviewFilter : public PSFilter -{ +class PSPreviewFilter : public PSFilter { public: PSPreviewFilter (PSInterpreter &psi); void activate (); @@ -38,7 +37,6 @@ class PSPreviewFilter : public PSFilter std::string version () const {return _version;} bool tightpage () const {return _tightpage;} void setDviScaleFactor (double dvi2bp) {_dvi2bp = dvi2bp;} - bool getBorders (double &left, double &right, double &top, double &bottom) const; void assignBorders (BoundingBox &bbox) const; bool getBoundingBox (BoundingBox &bbox) const; double height () const; diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp index eb09cc0b8a3..75d83f2b4b6 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/PsSpecialHandler.cpp @@ -267,6 +267,11 @@ bool PsSpecialHandler::process (const string &prefix, istream &is, SpecialAction * @param[in] fname EPS/PDF file to be included * @param[in] attr attributes given with psfile/pdffile special */ void PsSpecialHandler::imgfile (FileType filetype, const string &fname, const unordered_map<string,string> &attr) { + // prevent warning about missing image file "/dev/null" which is + // added by option "psfixbb" of the preview package + if (fname == "/dev/null") + return; + const char *filepath = FileFinder::instance().lookup(fname, false); if (!filepath && FileSystem::exists(fname)) filepath = fname.c_str(); @@ -398,31 +403,19 @@ static bool transform_box_extents (const Matrix &matrix, double &w, double &h, d void PsSpecialHandler::dviEndPage (unsigned, SpecialActions &actions) { BoundingBox bbox; if (_previewFilter.getBoundingBox(bbox)) { // is there any data written by preview package? - double w = max(0.0, _previewFilter.width()); - double h = max(0.0, _previewFilter.height()); - double d = max(0.0, _previewFilter.depth()); + double w=0, h=0, d=0; if (actions.getBBoxFormatString() == "preview" || actions.getBBoxFormatString() == "min") { if (actions.getBBoxFormatString() == "preview") { + w = max(0.0, _previewFilter.width()); + h = max(0.0, _previewFilter.height()); + d = max(0.0, _previewFilter.depth()); actions.bbox() = bbox; Message::mstream() << "\napplying bounding box set by"; } else { - // compute height, depth and width depending on the - // tight bounding box derived from the objects on the page - double y0 = bbox.maxY()-h; // y coordinate of the baseline - h = actions.bbox().maxY()-y0; - if (h < 0) { - h = 0; - d = actions.bbox().height(); - } - else { - d = y0-actions.bbox().minY(); - if (d < 0) { - h = actions.bbox().height(); - d = 0; - } - } w = actions.bbox().width(); + h = max(0.0, -actions.bbox().minY()); + d = max(0.0, actions.bbox().maxY()); Message::mstream() << "\ncomputing extents based on data set by"; } Message::mstream() << " preview package (version " << _previewFilter.version() << ")\n"; @@ -442,28 +435,28 @@ void PsSpecialHandler::dviEndPage (unsigned, SpecialActions &actions) { "height=" << XMLString(h*bp2pt) << "pt, " "depth=" << XMLString(d*bp2pt) << "pt\n"; } - } #if 0 - XMLElementNode *rect = new XMLElementNode("rect"); - rect->addAttribute("x", actions.bbox().minX()); - rect->addAttribute("y", actions.bbox().minY()); - rect->addAttribute("width", w); - rect->addAttribute("height", h+d); - rect->addAttribute("fill", "none"); - rect->addAttribute("stroke", "red"); - rect->addAttribute("stroke-width", "0.5"); - actions.appendToPage(rect); - if (d > 0) { - XMLElementNode *line = new XMLElementNode("line"); - line->addAttribute("x1", actions.bbox().minX()); - line->addAttribute("y1", actions.bbox().minY()+h); - line->addAttribute("x2", actions.bbox().maxX()); - line->addAttribute("y2", actions.bbox().minY()+h); - line->addAttribute("stroke", "blue"); - line->addAttribute("stroke-width", "0.5"); - actions.appendToPage(line); - } + auto rect = util::make_unique<XMLElementNode>("rect"); + rect->addAttribute("x", actions.bbox().minX()); + rect->addAttribute("y", actions.bbox().minY()); + rect->addAttribute("width", w); + rect->addAttribute("height", h+d); + rect->addAttribute("fill", "none"); + rect->addAttribute("stroke", "red"); + rect->addAttribute("stroke-width", "0.1"); + actions.appendToPage(std::move(rect)); + if (d > 0) { + auto line = util::make_unique<XMLElementNode>("line"); + line->addAttribute("x1", actions.bbox().minX()); + line->addAttribute("y1", actions.bbox().minY()+h); + line->addAttribute("x2", actions.bbox().maxX()); + line->addAttribute("y2", actions.bbox().minY()+h); + line->addAttribute("stroke", "blue"); + line->addAttribute("stroke-width", "0.1"); + actions.appendToPage(std::move(line)); + } #endif + } } // close dictionary TeXDict and execute end-hook if defined if (_psSection == PS_BODY) { diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp index ef46850c80e..14bfeacaf85 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/version.hpp @@ -22,7 +22,7 @@ #define VERSION_HPP constexpr const char *PROGRAM_NAME = "dvisvgm"; -constexpr const char *PROGRAM_VERSION = "2.4.1"; +constexpr const char *PROGRAM_VERSION = "2.4.2"; #endif |