Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] DejaVu Sans Mono as default font crossplatform #42

Merged
merged 15 commits into from Jul 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -63,3 +63,7 @@ portaudio/portaudio/lib-stamp
portaudio/portaudio/ltmain.sh
portaudio/portaudio/portaudio-2.0.pc
*.dirstamp

# macOS
.DS_Store

4 changes: 2 additions & 2 deletions Makefile.am
Expand Up @@ -42,10 +42,10 @@ EXTRA_DIST = LICENSE.txt README.txt INSTALL.txt

# subdirs that are built,
# mac before src due to uninstall target order kludge (see mac/Makfile.am)
SUBDIRS = $(EXTRA_SUBDIRS) mac src man doc tcl extra
SUBDIRS = $(EXTRA_SUBDIRS) mac src man doc tcl extra font

# subdirs that are always included in the dist, etc.
DIST_SUBDIRS = asio doc extra mac man po portmidi portaudio src tcl
DIST_SUBDIRS = asio doc extra font mac man po portmidi portaudio src tcl

#########################################
##### Targets #####
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Expand Up @@ -492,6 +492,7 @@ AS_IF([test ! "x${WISH}" = "x" -a x"$MACOSX" = x"yes"],[
AC_CONFIG_FILES([Makefile
asio/Makefile
doc/Makefile
font/Makefile
mac/Makefile
man/Makefile
portaudio/Makefile
Expand Down
Binary file added font/DejaVuSansMono.ttf
Binary file not shown.
187 changes: 187 additions & 0 deletions font/LICENSE
@@ -0,0 +1,187 @@
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)


Bitstream Vera Fonts Copyright
------------------------------

Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute the
Font Software, including without limitation the rights to use, copy, merge,
publish, distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to the
following conditions:

The above copyright and trademark notices and this permission notice shall
be included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional glyphs or characters may be added to the Fonts, only if the fonts
are renamed to names not containing either the words "Bitstream" or the word
"Vera".

This License becomes null and void to the extent applicable to Fonts or Font
Software that has been modified and is distributed under the "Bitstream
Vera" names.

The Font Software may be sold as part of a larger software package but no
copy of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
FONT SOFTWARE.

Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font Software
without prior written authorization from the Gnome Foundation or Bitstream
Inc., respectively. For further information, contact: fonts at gnome dot
org.

Arev Fonts Copyright
------------------------------

Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.

Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and
associated documentation files (the "Font Software"), to reproduce
and distribute the modifications to the Bitstream Vera Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute, and/or sell copies of the Font Software, and to permit
persons to whom the Font Software is furnished to do so, subject to
the following conditions:

The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.

The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Tavmjong Bah" or the word "Arev".

This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Tavmjong Bah Arev" names.

The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.

THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Except as contained in this notice, the name of Tavmjong Bah shall not
be used in advertising or otherwise to promote the sale, use or other
dealings in this Font Software without prior written authorization
from Tavmjong Bah. For further information, contact: tavmjong @ free
. fr.

TeX Gyre DJV Math
-----------------
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.

Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski
(on behalf of TeX users groups) are in public domain.

Letters imported from Euler Fraktur from AMSfonts are (c) American
Mathematical Society (see below).
Bitstream Vera Fonts Copyright
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera
is a trademark of Bitstream, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of the fonts accompanying this license (“Fonts”) and associated
documentation
files (the “Font Software”), to reproduce and distribute the Font Software,
including without limitation the rights to use, copy, merge, publish,
distribute,
and/or sell copies of the Font Software, and to permit persons to whom
the Font Software is furnished to do so, subject to the following
conditions:

The above copyright and trademark notices and this permission notice
shall be
included in all copies of one or more of the Font Software typefaces.

The Font Software may be modified, altered, or added to, and in particular
the designs of glyphs or characters in the Fonts may be modified and
additional
glyphs or characters may be added to the Fonts, only if the fonts are
renamed
to names not containing either the words “Bitstream” or the word “Vera”.

This License becomes null and void to the extent applicable to Fonts or
Font Software
that has been modified and is distributed under the “Bitstream Vera”
names.

The Font Software may be sold as part of a larger software package but
no copy
of one or more of the Font Software typefaces may be sold by itself.

THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
FOUNDATION
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,
SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN
ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR
INABILITY TO USE
THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the names of GNOME, the GNOME
Foundation,
and Bitstream Inc., shall not be used in advertising or otherwise to promote
the sale, use or other dealings in this Font Software without prior written
authorization from the GNOME Foundation or Bitstream Inc., respectively.
For further information, contact: fonts at gnome dot org.

AMSFonts (v. 2.2) copyright

The PostScript Type 1 implementation of the AMSFonts produced by and
previously distributed by Blue Sky Research and Y&Y, Inc. are now freely
available for general use. This has been accomplished through the
cooperation
of a consortium of scientific publishers with Blue Sky Research and Y&Y.
Members of this consortium include:

Elsevier Science IBM Corporation Society for Industrial and Applied
Mathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)

In order to assure the authenticity of these fonts, copyright will be
held by
the American Mathematical Society. This is not meant to restrict in any way
the legitimate use of the fonts, such as (but not limited to) electronic
distribution of documents containing these fonts, inclusion of these fonts
into other public domain or commercial font collections or computer
applications, use of the outline data to create derivative fonts and/or
faces, etc. However, the AMS does require that the AMS copyright notice be
removed from any derivative versions of the fonts which have been altered in
any way. In addition, to ensure the fidelity of TeX documents using Computer
Modern fonts, Professor Donald Knuth, creator of the Computer Modern faces,
has requested that any alterations which yield different font metrics be
given a different name.

$Id$
8 changes: 8 additions & 0 deletions font/Makefile.am
@@ -0,0 +1,8 @@
#########################################
##### Files, Binaries, & Libs #####

# files that are included but not built
EXTRA_DIST = \
DejaVuSansMono.ttf \
LICENSE \
README.txt
54 changes: 54 additions & 0 deletions font/README.txt
@@ -0,0 +1,54 @@
# Pure Data font resources

This directory contains font files for use with the Pure Data GUI.

The default font for Pd is DejaVu Sans Mono (DVSM) and it is included with Pd
based on the platform.

You can see which font Pd is using by looking for the font information prints
when the log level is set to "4 all."

## Linux

DVSM is usually installed with the system & is a dependency for the puredata
package. The included font file in this directory are not installed with Pd.
The fallback font when not found is Courier.

The default font weight on Linux is bold.

## macOS

DVSM is included within the Pd .app bundle. If Pd is run from the commandline
DVSM needs to be installed to the system otherwise the fallback font is Monaco.

The default font weight on macOS is normal.

## Windows

Currently DVSM needs to be installed to the system otherwise the fallback font
is Courier. In the future DVSM will be included & loaded by Pd without requring
a separate installation.

The default font weight on Windows is bold.

## Experimenting with Different Fonts

Typically any fixed-width font will work with Pd, although the legibility and
object sizing may vary. Non fixed-width fonts will usually render much longer
object boxes as the sizing does not take into account variable character width.

You can experiment with different fonts and font weights (normal or bold) by
using the following Pd startup flags or when running Pd on the commandline:

# specify default font (by name)
pd -font-face Courier

# specify default font weight (normal or bold)
pd -font-weight bold

# specify default font size in points
pd -font-size 14

Try this for some unusable fun:

pd -font-face "Zapf Dingbats" -font-weight normal -font-size 16
1 change: 1 addition & 0 deletions mac/README.txt
Expand Up @@ -22,6 +22,7 @@ Pd-0.47.1.app/Contents
/bin <- pd binaries
/doc <- build in docs & help files
/extra <- core externals
/font <- included fonts
/include <- Pd source header files
/po <- text translation files
/tcl <- Pd GUI scripts
Expand Down
1 change: 1 addition & 0 deletions mac/osx-app.sh
Expand Up @@ -266,6 +266,7 @@ cp stuff/Info.plist $APP/Contents/
rm $APP/Contents/Resources/Wish.icns
cp stuff/pd.icns $APP/Contents/Resources/
cp stuff/pd-file.icns $APP/Contents/Resources/
cp -R ../font $APP/Contents/Resources/

# set version identifiers & contextual strings in Info.plist,
# version strings can only use 0-9 and periods, so replace "-" & "test" with "."
Expand Down
2 changes: 2 additions & 0 deletions mac/stuff/Info.plist
Expand Up @@ -35,5 +35,7 @@
<string>0.38</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>ATSApplicationFontsPath</key>
<string>font</string>
</dict>
</plist>
5 changes: 2 additions & 3 deletions src/s_main.c
Expand Up @@ -71,11 +71,10 @@ int sys_nmidiin = -1;
int sys_midiindevlist[MAXMIDIINDEV] = {1};
int sys_midioutdevlist[MAXMIDIOUTDEV] = {1};

#ifdef __APPLE__
char sys_font[100] = "Monaco";
char sys_font[100] = "DejaVu Sans Mono";
#if __APPLE__
char sys_fontweight[10] = "normal";
#else
char sys_font[100] = "DejaVu Sans Mono";
char sys_fontweight[10] = "bold";
#endif
static int sys_main_srate;
Expand Down
10 changes: 7 additions & 3 deletions tcl/pd-gui.tcl
Expand Up @@ -331,7 +331,11 @@ proc init_for_platform {} {
# from the commandline incorporates the special mac event handling
package require apple_events
set ::modifier "Mod1"
if {$::tcl_version >= 8.5} {
if {$::tcl_version < 8.5} {
# old default font for Tk 8.4 on macOS
# since font detection requires 8.5+
set ::font_family "Monaco"
} else {
# Tk Cocoa wants lower case keys when binding with shift
set ::bind_shiftcaps 0
}
Expand Down Expand Up @@ -459,15 +463,15 @@ proc get_font_for_size {fsize} {
# always do a good job of choosing in respect to Pd's needs. So this chooses
# from a list of fonts that are known to work well with Pd.
proc find_default_font {} {
set testfonts {"DejaVu Sans Mono" "Bitstream Vera Sans Mono" \
set testfonts {"DejaVu Sans Mono" "Bitstream Vera Sans Mono" "Monaco" \
"Inconsolata" "Courier 10 Pitch" "Andale Mono" "Droid Sans Mono"}
foreach family $testfonts {
if {[lsearch -exact -nocase [font families] $family] > -1} {
set ::font_family $family
break
}
}
::pdwindow::verbose 0 "Default font: $::font_family\n"
::pdwindow::verbose 0 "Detected font: $::font_family\n"
}

proc set_base_font {family weight} {
Expand Down