A quick sanity check: if a positive $x \in \mathcal{B} (\mathcal{H})$ has an isolated point $0$ in its spectrum and we define a function $$g(t) = \begin{cases} 1; &t = 0\\ 0; &t \neq 0 \end{cases},$$ then $p := g(x) \in \mathcal{B} (\mathcal{H})$ is a projection. Does it project exactly onto $\ker x$?
Edit: forgot that $x$ is positive.
As you have already observed, $xg(x) = 0$ implies $\mathrm{im}(g(x)) \subseteq \ker(x)$. The definition of functional calculus also makes it clear that $g(x)$ is an orthogonal projection. So it suffices to show $\mathrm{im}(g(x)) \supseteq \ker(x)$.
Now, let $h(t) = 1 - g(t)$. Then $h(x) = 1 - g(x)$. As $g(x)$ is an orthogonal projection, we see that $\ker(h(x)) = \mathrm{im}(g(x))$. Now, $h(0) = 0$. We observe that any continuous function on $\sigma(x)$ that takes value $0$ at $t = 0$ can be uniformly approximated by a sequence of polynomials with no constant term. Indeed, if $q_i \rightarrow h$ uniformly on $\sigma(x)$, then $p_i = q_i - q_i(0) \rightarrow h$ uniformly as well. Thus, $p_i(x) \rightarrow h(x)$. We observe that, for any $\xi \in \ker(x)$, $[p_i(x)]\xi = 0$ as $x^n \xi = 0$ for all $n > 0$ and $p_i$ is a polynomial with no constant term. Hence, $[h(x)]\xi = 0$, i.e., $\ker(x) \subseteq \ker(h(x)) = \mathrm{im}(g(x))$.