Motivated by fractal geometry of self-affine carpets and sponges, Feng and Huang [J. Math. Pures Appl. 106(9) (2016), 411–452] introduced weighted topological entropy and pressure for factor maps between dynamical systems, and proved variational principles for them. We introduce a new approach to this theory. Our new definitions of weighted topological entropy and pressure are very different from the original definitions of Feng and Huang. The equivalence of the two definitions seems highly non-trivial. Their equivalence can be seen as a generalization of the dimension formula for the Bedford–McMullen carpet in purely topological terms.