Skip to content

Commit

Permalink
updated for version 7.4.393
Browse files Browse the repository at this point in the history
Problem:    Text drawing on newer MS-Windows systems is suboptimal.  Some
            multi-byte characters are not displayed, even though the same font
            in Notepad can display them. (Srinath Avadhanula)
Solution:   Add the 'renderoptions' option to enable Direct-X drawing. (Taro
            Muraoka)
  • Loading branch information
brammool committed Aug 6, 2014
1 parent 8c1329c commit b5a7a8b
Show file tree
Hide file tree
Showing 16 changed files with 1,390 additions and 23 deletions.
1 change: 1 addition & 0 deletions runtime/doc/eval.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6622,6 +6622,7 @@ dialog_con Compiled with console dialog support.
dialog_gui Compiled with GUI dialog support.
diff Compiled with |vimdiff| and 'diff' support.
digraphs Compiled with support for digraphs.
directx Compiled with support for Direct-X and 'renderoptions'.
dnd Compiled with support for the "~ register |quote_~|.
dos16 16 bits DOS version of Vim.
dos32 32 bits DOS (DJGPP) version of Vim.
Expand Down
71 changes: 71 additions & 0 deletions runtime/doc/options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5650,6 +5650,77 @@ A jump table for the options with a short description can be found at |Q_op|.
this option at the default "on". Only switch it off when working with
old Vi scripts.

*'renderoptions'* *'rop'*
'renderoptions' 'rop' string (default: empty)
global
{not in Vi}
{only available when compiled with GUI and DIRECTX on
MS-Windows}
Select a text renderer and set its options. The options depend on the
renderer.

Syntax: >
set rop=type:{renderer}(,{name}:{value})*
<
Currently, only one optional renderer is available.

render behavior ~
directx Vim will draw text using DirectX (DirectWrite). It makes
drawn glyphs more beautiful than default GDI.
It requires 'encoding' is "utf-8", and only works on
MS-Windows Vista or newer version.

Options:
name meaning type value ~
gamma gamma float 1.0 - 2.2 (maybe)
contrast enhancedContrast float (unknown)
level clearTypeLevel float (unknown)
geom pixelGeometry int 0 - 2 (see below)
renmode renderingMode int 0 - 6 (see below)
taamode textAntialiasMode int 0 - 3 (see below)

See this URL for detail:
http://msdn.microsoft.com/en-us/library/dd368190.aspx

For geom: structure of a device pixel.
0 - DWRITE_PIXEL_GEOMETRY_FLAT
1 - DWRITE_PIXEL_GEOMETRY_RGB
2 - DWRITE_PIXEL_GEOMETRY_BGR

See this URL for detail:
http://msdn.microsoft.com/en-us/library/dd368114.aspx

For renmode: method of rendering glyphs.
0 - DWRITE_RENDERING_MODE_DEFAULT
1 - DWRITE_RENDERING_MODE_ALIASED
2 - DWRITE_RENDERING_MODE_GDI_CLASSIC
3 - DWRITE_RENDERING_MODE_GDI_NATURAL
4 - DWRITE_RENDERING_MODE_NATURAL
5 - DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC
6 - DWRITE_RENDERING_MODE_OUTLINE

See this URL for detail:
http://msdn.microsoft.com/en-us/library/dd368118.aspx

For taamode: antialiasing mode used for drawing text.
0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT
1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE
2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE
3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED

See this URL for detail:
http://msdn.microsoft.com/en-us/library/dd368170.aspx

Example: >
set encoding=utf-8
set gfn=Ricty_Diminished:h12:cSHIFTJIS
set rop=type:directx
<
If select a raster font (Courier, Terminal or FixedSys) to
'guifont', it fallbacks to be drawn by GDI automatically.

Other render types are currently not supported.

*'report'*
'report' number (default 2)
global
Expand Down
1 change: 1 addition & 0 deletions runtime/doc/various.txt
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ N *+dialog_con* Support for |:confirm| with console dialog.
N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog.
N *+diff* |vimdiff| and 'diff'
N *+digraphs* |digraphs| *E196*
m *+directx* Win32 GUI only: DirectX and |'renderoptions'|
*+dnd* Support for DnD into the "~ register |quote_~|.
B *+emacs_tags* |emacs-tags| files
N *+eval* expression evaluation |eval.txt|
Expand Down
32 changes: 27 additions & 5 deletions src/Make_cyg.mak
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Cygwin application use the Makefile (just like on Unix).
#
# GUI no or yes: set to yes if you want the GUI version (yes)
# DIRECTX no or yes: set to yes if you want use DirectWrite (no)
# PERL define to path to Perl dir to get Perl support (not defined)
# PERL_VER define to version of Perl being used (56)
# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes)
Expand Down Expand Up @@ -88,6 +89,10 @@ ifndef ARCH
ARCH = i386
endif

ifndef DIRECTX
DIRECTX = no
endif

ifndef WINVER
WINVER = 0x0500
endif
Expand Down Expand Up @@ -469,6 +474,15 @@ endif

endif

##############################
ifeq (yes, $(DIRECTX))
# Only allow DIRECTX for a GUI build.
DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
EXTRA_OBJS += $(OUTDIR)/gui_dwrite.o
EXTRA_LIBS += -ld2d1 -ldwrite
USE_STDCPLUS = yes
endif

##############################
ifdef XPM
# Only allow XPM for a GUI build.
Expand All @@ -495,11 +509,7 @@ ifeq (yes, $(OLE))
DEFINES += -DFEAT_OLE
EXTRA_OBJS += $(OUTDIR)/if_ole.o
EXTRA_LIBS += -loleaut32
ifeq (yes, $(STATIC_STDCPLUS))
EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
else
EXTRA_LIBS += -lstdc++
endif
USE_STDCPLUS = yes
endif

##############################
Expand All @@ -513,6 +523,15 @@ MKDIR = mkdir
DIRSLASH = \\
endif

##############################
ifeq (yes, $(USE_STDCPLUS))
ifeq (yes, $(STATIC_STDCPLUS))
EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
else
EXTRA_LIBS += -lstdc++
endif
endif

#>>>>> end of choices
###########################################################################

Expand Down Expand Up @@ -643,6 +662,9 @@ $(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
$(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o

$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
$(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o

$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
$(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o

Expand Down
35 changes: 30 additions & 5 deletions src/Make_ming.mak
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ DEBUG=no
OPTIMIZE=MAXSPEED
# set to yes to make gvim, no for vim
GUI=yes
# set to yes if you want to use DirectWrite (DirectX)
DIRECTX=no
# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE]
# Set to TINY to make minimal version (few features).
FEATURES=BIG
Expand Down Expand Up @@ -456,6 +458,14 @@ endif
endif
endif

# DirectWrite (DirectX)
ifeq ($(DIRECTX),yes)
# Only allow DirectWrite for a GUI build.
ifeq (yes, $(GUI))
DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
endif
endif

# Only allow XPM for a GUI build.
ifeq (yes, $(GUI))

Expand Down Expand Up @@ -593,6 +603,14 @@ OBJ += $(OUTDIR)/netbeans.o
LIB += -lwsock32
endif
endif
ifeq ($(DIRECTX),yes)
# Only allow DIRECTX for a GUI build.
ifeq (yes, $(GUI))
OBJ += $(OUTDIR)/gui_dwrite.o
LIB += -ld2d1 -ldwrite
USE_STDCPLUS = yes
endif
endif
ifdef XPM
# Only allow XPM for a GUI build.
ifeq (yes, $(GUI))
Expand Down Expand Up @@ -650,11 +668,7 @@ endif
ifeq (yes, $(OLE))
LIB += -loleaut32
OBJ += $(OUTDIR)/if_ole.o
ifeq (yes, $(STATIC_STDCPLUS))
LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
else
LIB += -lstdc++
endif
USE_STDCPLUS = yes
endif

ifeq (yes, $(MBYTE))
Expand All @@ -678,6 +692,14 @@ endif
DEFINES+=-DDYNAMIC_ICONV
endif

ifeq (yes, $(USE_STDCPLUS))
ifeq (yes, $(STATIC_STDCPLUS))
LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
else
LIB += -lstdc++
endif
endif

all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll

vimrun.exe: vimrun.c
Expand Down Expand Up @@ -751,6 +773,9 @@ $(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h
$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL)
$(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o

$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
$(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o

$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
$(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o

Expand Down
21 changes: 21 additions & 0 deletions src/Make_mvc.mak
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#
# GUI interface: GUI=yes (default is no)
#
# GUI with DirectWrite(DirectX): DIRECTX=yes
# (default is no, requires GUI=yes)
#
# OLE interface: OLE=yes (usually with GUI=yes)
#
# Multibyte support: MBYTE=yes (default is no)
Expand Down Expand Up @@ -168,6 +171,9 @@ OBJDIR = .\ObjG
!else
OBJDIR = .\ObjC
!endif
!if "$(DIRECTX)" == "yes"
OBJDIR = $(OBJDIR)X
!endif
!if "$(OLE)" == "yes"
OBJDIR = $(OBJDIR)O
!endif
Expand Down Expand Up @@ -292,6 +298,13 @@ NBDEBUG_SRC = nbdebug.c
NETBEANS_LIB = WSock32.lib
!endif

# DirectWrite(DirectX)
!if "$(DIRECTX)" == "yes"
DIRECTX_DEFS = -DFEAT_DIRECTX -DDYNAMIC_DIRECTX
DIRECTX_INCL = gui_dwrite.h
DIRECTX_OBJ = $(OUTDIR)\gui_dwrite.obj
!endif

!ifndef XPM
# XPM is not set, use the included xpm files, depending on the architecture.
!if "$(CPU)" == "AMD64"
Expand Down Expand Up @@ -642,6 +655,12 @@ GUI_LIB = \
SUBSYSTEM = console
!endif

!if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes"
CFLAGS = $(CFLAGS) $(DIRECTX_DEFS)
GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL)
GUI_OBJ = $(GUI_OBJ) $(DIRECTX_OBJ)
!endif

# iconv.dll library (dynamically loaded)
!ifndef ICONV
ICONV = yes
Expand Down Expand Up @@ -1107,6 +1126,8 @@ $(OUTDIR)/gui_beval.obj: $(OUTDIR) gui_beval.c $(INCL) $(GUI_INCL)

$(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL)

$(OUTDIR)/gui_dwrite.obj: $(OUTDIR) gui_dwrite.cpp $(INCL) $(GUI_INCL)

$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL)

$(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c $(INCL)
Expand Down
3 changes: 3 additions & 0 deletions src/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -12464,6 +12464,9 @@ f_has(argvars, rettv)
#ifdef FEAT_DIGRAPHS
"digraphs",
#endif
#ifdef FEAT_DIRECTX
"directx",
#endif
#ifdef FEAT_DND
"dnd",
#endif
Expand Down
Loading

0 comments on commit b5a7a8b

Please sign in to comment.