I am using the following code to redefine a breve in order to work with a particular truetype font I must use (Elegant Garamond) and the particular piece of code generates an error (but still works) and it generates output on the typesetted document.
\documentclass[10pt,a4paper,openany]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[romanian]{babel}
\usepackage{eg} %this is the definition for the font I use
\pdfmapfile{+eg.map}
\newcommand\chara{a}
\makeatletter
\def\kernbrevea#1{\kern#1\dimexpr0.47em-\strip@pt\fontdimen1\font\dimexpr-0.2em\relax\relax}
\makeatother
\begin{document} %begining here avoids one error that \catcode line below generates
\catcode`\ă=\active
\def ă{\raisebox{.0em}\u\kernbrevea{-}{\chara}}%
text with ă character
\end{document}
Compiling the file gives me two errors:
! Missing number, treated as zero.
<to be read again>
\protect
l.17 \catcode`\ă
=\active
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Package inputenc Error: Keyboard character used is undefined
(inputenc) in inputencoding `utf8'.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.17 \catcode`\ă
=\active
You need to provide a definition with \DeclareInputText
or \DeclareInputMath before using this key.
The output is an expected "text with ă character" but just before, on the first line, there is a string: "=,". As in the screencap:
Is there a way to supress it or to solve the errors I get?
I have read the suggested part in The TeXbook but I can't find the logic (well, I barely know TeX/LaTeX). Obviously my code is broken, but I can't find in what way or if there are some problems with my font...

\ăas a command name if you are using UTF8 encoding, use\abreveor some such name. – David Carlisle Mar 03 '17 at 13:38