Skip to content

Commit

Permalink
Enhance: add ability to set any glyph as a room symbol (Mudlet#1543)
Browse files Browse the repository at this point in the history
This is a squashed down commit containing several commits with
messages - this is the edited combination of all the messages:

As well as being able to use any grapheme it is possible to use a
short word as well as anything printable from any of the Unicode
Multiple Planes; although the former will become smaller to fit within
both the square and round room shapes on the 2D mapper.

Adds controls to the profile preference to set the (preferred) font to
use to set the room symbols from and a checkbox to only use that font.
Additionally a sub-dialog can be brought up which lists the details of all
the different symbols on the map - showing the Unicode codepoint(s) for
each and showing how they would be rendered if only the selected font is
used and if any font is permitted, along with a count of the usages and
the rooms that use each one...  A status icon is also displayed showing
whether the symbol can be rendered entirely with the selected font (green
tick), only by using glyphs from other fonts (yellow ! warning) or not with
the current fonts on the system (red/white cross).  This allows a user to
make a sensible selection of a font to use or whether they will have a
problem (and a replacement by the replacement character '�') for any
symbols.

Updates Lua setRoomChar and getRoomChar to handle the wider
range of things that can be used. getRoomChar NOW allows for an
existing character to be cleared with an empty string or a space as
the char attribute.

The map format version has been incremented to allow the data needed to be
saved directly into the binary file format but failback code is in place
that means that this feature can be carried in map and room user data
instead for map format versions down to 17 - the current default is 18 and
there is limited support to fail gracefully down to the 16 that Mudlet 2.1
uses (all the room letter markings that are not supported will become '?',
and the font data will be lost, but the correct room character data will
still be in the room user data.)

Following review:
* I replaced some colour specifications (white and transparent) with
   Qt constants.

* Use the same inline function flushSymbolPixmapCache() to clear
   the map symbol pixmap cache in all places where it might be useful.

* Simplify a couple of places where an if(...) {...} else {...} can be
   replaced with the (...) ? (...) : (...) operator.

* Limit the number of room numbers displayed for each symbol in the
   new widget - to avoid complications where there are huge numbers
   of rooms using a symbol.

* Replace a use of QTableWidget::clearContents() with
   QTableWidgets::setRowCount(0) as I was getting some odd, deep
   in the Qt internal library issues {Fatal Seg. Faults!} with the former,
   which I suspect, but could not prove, might have been a
   re-entrancy issue caused by the method containing it being called
   indirectly by an asynchronous SIGNAL/SLOT originating in the
   value change from the map symbol font selection QFontComboBox...

Revised to NOT do scaling when drawing room symbols from cache:
the previous QPainter::drawPixmap(...) performed a scaling operation to
make the symbol pixmap fit the specified rectangle. This is the cause
behind the poor rendering of text characters as the scaling undoes the
benefits of anti-aliasing and takes time to do. This should be faster now
because the pixmaps are generated at the size/resolution they are needed
(though they do have to be thrown away and regenerated if the zoom
or other sizing factors change) - they do however look better to me!

Also:
* merged (int) TRoom::xzoom and TRoom::yzoom into TRoom::xyzoom.
* added the symbol scaling "fudge-factor" to the "Special Options" tab of
  the "Profile preferences" dialog - it may be helpful to artificially
  over-size (> 1.00) or under-size (< 1.00) the symbols in some situations.
* uses the word symbol rather than just glyph/grapheme in some texts.

Also modified 2D mapper "Symbol" tooltip to observe that more than one
letter/symbol can be used (although they will be drawn smaller so that they
still fit).

Add tool-tips to profile preferences dialog for font controls (except for
"fudge factor" control (with range x0.50 to x2.00 for scaling of symbol
to test rectangle used to fit it into the room shape)...

I have consistently mispelled chosen as choosen but I have fixed that
now...!

Also added tooltips to map glyph usage table/widget.

WorkAround: try to force a specific US mirror for zziplib on AppVeyor CI

AppVeyor is based in Vancouver, Canada so the nearest SF Mirror is in the
US so this commit forces the use of that mirror for that library for the CI
build process as an attempt to get around the repeated, intermittent
failures to get that library from SourceForge (it is now the only item that
needs to be downloaded from there for such builds)...

Also adds another CI file that was not mentioned before in the qmake
project file and thus did not show up in the Qt IDE.

Following extensive discussions it has been made clear that introducing
replacements for the lua [gs]etRoomChar(...) is not going to happen.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
  • Loading branch information
SlySven committed Mar 28, 2018
1 parent 3d69744 commit 91a08c3
Show file tree
Hide file tree
Showing 15 changed files with 979 additions and 363 deletions.
10 changes: 9 additions & 1 deletion CI/appveyor.install.ps1
Expand Up @@ -264,7 +264,15 @@ function InstallLibzip() {
}

function InstallZziplib() {
DownloadFile "https://sourceforge.net/projects/zziplib/files/zziplib13/0.13.62/zziplib-0.13.62.tar.bz2/download" "zziplib-0.13.62.tar.bz2"
if($Env:APPVEYOR){
# The environmental variable APPVEYOR is set to TRUE on AppVeyor CI system
# Use a specific US Mirror - as an attempt to get around intermittent
# failures when using the generic SourceForge URL:
DownloadFile "https://superb-sea2.dl.sourceforge.net/project/zziplib/zziplib13/0.13.62/zziplib-0.13.62.tar.bz2" "zziplib-0.13.62.tar.bz2"
} else {
# Use the original one:
DownloadFile "https://sourceforge.net/projects/zziplib/files/zziplib13/0.13.62/zziplib-0.13.62.tar.bz2/download" "zziplib-0.13.62.tar.bz2"
}
ExtractTar "zziplib-0.13.62.tar.bz2" "zziplib"
Set-Location zziplib\zziplib-0.13.62
Step "changing configure script"
Expand Down

0 comments on commit 91a08c3

Please sign in to comment.