function [px,py,s,B,im,tmp]=createPolyChar(c,mk)
% createPolyChar <Create a polygon from image.>
% Usage:: [px,py]=createPolyChar(c)
%

% revision history:
% 12/04/18 Mark D. Shattuck <mds> createPolyChar.m

%% Parse Input
if(~exist('mk','var') || isempty(mk))
	mk=25;
end

%% Main

f=figure('Visible','off','position',get(0,'screensize'));
clf;
ht=text(0.01,.01,c);
s=300;
set(ht,'fontsize',s,'FontName','Times New Roman');
%set(ht,'fontsize',s,'FontName','Comic Sans MS');
%set(ht,'fontsize',s,'FontName','Copper Black');
set(ht,'horizontalAlignment','left','verticalAlignment','bottom');
%set(ht,'fontweight','bold');

axis('equal',[0 1 0 1]);
axis off;
im=getframe;
im=im.cdata;
%im=imread('Y.bmp');
im=double(im(:,:,1));
white=max(im(:));
% [xx yy]=ndgrid(-20:20,-20:20);
% rr=abs(xx+1i*yy);
%mk=25;
tmp=im;
[Nx,Ny]=size(tmp);
im=white*ones(Nx+mk,Ny+mk);
im(fix(mk/2)+(1:Nx),fix(mk/2)+(1:Ny))=tmp;
% im=double(conv2(double(im),(1-tanh(rr-c))/2,'same')./conv2(double(im)*0+1,(1-tanh(rr-c))/2,'same')>200);
im=double(conv2(im,ones(mk),'same')./conv2(im*0+1,ones(mk),'same')>200);

B=bwboundaries(~(im>0));
py=B{1}(:,1);px=B{1}(:,2);
b=max(py);
px=px/s;py=(b-py)/s;
close(f);


