Remove certain AFM tags

Here we remove lines from the AFM file based on a set of regular expressions.  At present we remove only "^Character" as this is the AFM tag that causes ugly warnings when used by R.  Others may be added in the future as needed.

Note that gzcopy_exclude() uses text mode to read and write the files so it can do the matching--the old gzcopy() used binary.  I have not run into a problem with this on my linux workstation but we may want to test under windows to make sure there are no gotchas.  Also in gzcopy_exclude() we use useBytes=TRUE in the grepl() call in order to avoid the warnings this generates any time a non-ascii character appears.  We might think about changing all grepl() calls to work this way at some point.
Should all conform to your preferences now.  Let me know if further action
is needed.

You might consider deleting the old gzcopy() when you are happy with the
update.

Unfortunately I'm not in a position to easily check this on windows or mac
so it would be convenient if you were able to test it on one of your
machines.

Grant



On Wed, Jul 23, 2014 at 4:36 PM, Winston Chang <notifications@github.com>
wrote:

> In R/utils.r:
>
> > +  close(srcfile)
> > +
> > +  # remove any line matching an exclusion pattern
> > +  if (length(exclusions)>0){
> > +    notexcluded <- rep(TRUE,length(srcdat))
> > +    for (i in 1:length(exclusions)){
> > +      notexcluded[grepl(exclusions[i],srcdat,useBytes=TRUE)] <- FALSE
> > +    }
> > +    srcdat <- srcdat[notexcluded]
> > +  }
> > +
> > +  # Add .gz if destination file is not specified
> > +  if (is.null(dest))  dest <- paste(src, ".gz", sep = "")
> > +
> > +  destfile <- gzfile(dest, "w")
> > +  writeLines(srcdat, con=destfile)
>
> Spaces around =.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/wch/extrafont/pull/38/files#r15313969>.
>